Skip to content

Commit

Permalink
Date: Thu, 21 Feb 2002 09:18:24 +0200
Browse files Browse the repository at this point in the history
From: "Mike Gorchak" <mike@malva.ua>
Subject: Re: Patches for QNX RtP again.

SDL_ph_image.c   - Added OpenGL update functions - fixed some application
crashes.
                   Some dead code removed, reformatting some functions.
SDL_ph_image_c.h - Added OpenGL update function prototype.
SDL_ph_video.c   - Added GL_GetAttribute and GL_SetAttribute functions
                   with next supported flags: SDL_GL_DOUBLEBUFFER,
                   SDL_GL_STENCIL_SIZE, SDL_GL_DEPTH_SIZE
                   GetWMInfo function (stub) has been implemented by me,
                   but not listed in device structure - fixed.
SDL_ph_wm.c      - fixed warning 'no return in non-void function'.
README.QNX       - Updating readme. Some spellcheck. ;-)
  • Loading branch information
slouken committed Mar 2, 2002
1 parent c626ad0 commit 0448ba7
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 138 deletions.
24 changes: 12 additions & 12 deletions README.QNX
@@ -1,17 +1,17 @@
README by Mike Gorchak <mike@malva.com.ua>
README by Mike Gorchak <mike@malva.ua>

Experimentally added OpenGL support in window mode (in fullscreen
mode not yet). If you have QNX RtP v6.1.0 w/ or w/o Patch A you need
to download new Photon3D runtime from http://developers.qnx.com. The
versions of OS before 6.1.0 is not supported.
OpenGL support was experimentally added in window mode (in
fullscreen mode not yet). If you have QNX RtP v6.1.0 w/ or w/o
Patch A you must download new Photon3D runtime from http://de-
velopers.qnx.com. The versions of OS before 6.1.0 are not sup-
ported.

Problems:
1. OpenGL support is very raw. It is often fail. Update function has
not been written yet. Fullscreen mode has not been written yet.
2. Photon has some errors in detecting how much bits per pixel has
videomode, creating images with different color depth.
3. No shared libraries yet. We need manually set flags as
--disable-shared.
1. Fullscreen mode (in OpenGL mode) has not been written yet.
2. Photon has some errors in detecting how much bits per pi-
xel videomode has.
3. No shared libraries yet. We need manually set flag to
'configure' --disable-shared.

Some building issues:

Expand All @@ -22,7 +22,7 @@ Some building issues:
--disable-video-x11 \
--disable-shared

a) without OpenGL support:
b) without OpenGL support:
./configure --prefix=/usr/local \
--disable-video-x11 \
--disable-shared \
Expand Down
158 changes: 77 additions & 81 deletions src/video/photon/SDL_ph_image.c
Expand Up @@ -33,62 +33,54 @@ static char rcsid =
#include "SDL_endian.h"
#include "SDL_ph_image_c.h"

//printf("%s:%s:%d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__ );

/* Various screen update functions available */
//static void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects);
//static void ph_DummyUpdate(_THIS, int numrects, SDL_Rect *rects);

int ph_SetupImage(_THIS, SDL_Surface *screen)
{
int type = 0;
int type = 0;

/* Determine image type */
switch(screen->format->BitsPerPixel)
{
case 8:{
type = Pg_IMAGE_PALETTE_BYTE;
}
break;
case 15:{
type = Pg_IMAGE_DIRECT_555;
}
break;
case 16:{
type = Pg_IMAGE_DIRECT_565;
}
break;
/* Determine image type */
switch(screen->format->BitsPerPixel)
{
case 8:{
type = Pg_IMAGE_PALETTE_BYTE;
}
break;
case 15:{
type = Pg_IMAGE_DIRECT_555;
}
break;
case 16:{
type = Pg_IMAGE_DIRECT_565;
}
break;
case 24:{
type = Pg_IMAGE_DIRECT_888;
}
break;
case 32:{
type = Pg_IMAGE_DIRECT_8888;
}
break;
default:{
/* should never get here */
fprintf(stderr,"error: unsupported bbp = %d\n",
screen->format->BitsPerPixel);
return -1;
}
break;
}

case 24:{
type = Pg_IMAGE_DIRECT_888;
}
break;

case 32:{
type = Pg_IMAGE_DIRECT_8888;
}
break;
default:{
/* should never get here */
fprintf(stderr,"error: unsupported bbp = %d\n",
screen->format->BitsPerPixel);
return -1;
}
break;
}
/* using shared memory for speed (set last param to 1) */
if ((SDL_Image = PhCreateImage(NULL, screen->w, screen->h, type, NULL, 0, 1)) == NULL)
{
fprintf(stderr,"error: PhCreateImage failed.\n");
return -1;
}

//using shared memory for speed (set last param to 1)
if ((SDL_Image = PhCreateImage( NULL, screen->w, screen->h, type, NULL, 0, 1 )) == NULL)
{
fprintf(stderr,"error: PhCreateImage failed.\n");
return -1;
}
screen->pixels = SDL_Image->image;

screen->pixels = SDL_Image->image;

this->UpdateRects = ph_NormalUpdate;
this->UpdateRects = ph_NormalUpdate;

return 0;
return 0;
}

int ph_SetupOCImage(_THIS, SDL_Surface *screen) //Offscreen context
Expand Down Expand Up @@ -172,39 +164,36 @@ int ph_SetupOCImage(_THIS, SDL_Surface *screen) //Offscreen context
return 0;
}

int ph_SetupOpenGLImage(_THIS, SDL_Surface* screen)
{
this->UpdateRects = ph_OpenGLUpdate;

return 0;
}

void ph_DestroyImage(_THIS, SDL_Surface *screen)
{
#if 0
if(SDL_Image == NULL)
return;
#endif
if (OCImage.offscreen_context != NULL)
{
PhDCRelease(OCImage.offscreen_context);
OCImage.offscreen_context = NULL;
free(OCImage.FrameData0);
OCImage.FrameData0 = NULL;
free(OCImage.FrameData1);
OCImage.FrameData1 = NULL;
}

if (OCImage.offscreen_context != NULL)
{
PhDCRelease(OCImage.offscreen_context);
OCImage.offscreen_context = NULL;
free(OCImage.FrameData0);
OCImage.FrameData0 = NULL;
free(OCImage.FrameData1);
OCImage.FrameData1 = NULL;
}

if (SDL_Image)
{
// SDL_Image->flags=Ph_RELEASE_IMAGE;
// PhReleaseImage(SDL_Image);
if (SDL_Image->image)
PgShmemDestroy(SDL_Image->image); // Use this if you using shared memory, or uncomment
// lines above if not (and comment this line ;-)
free(SDL_Image);
SDL_Image = NULL;
}
if (SDL_Image)
{
PgShmemDestroy(SDL_Image->image);
free(SDL_Image);
SDL_Image = NULL;
}

if ( screen )
{
screen->pixels = NULL;
}
if (screen)
{
screen->pixels = NULL;
}
}

int ph_ResizeImage(_THIS, SDL_Surface *screen, Uint32 flags)
Expand All @@ -213,12 +202,12 @@ int ph_ResizeImage(_THIS, SDL_Surface *screen, Uint32 flags)

if( flags & SDL_HWSURFACE)
{
OCImage.flags = flags; //needed for SDL_DOUBLEBUF check
return ph_SetupOCImage(this,screen);
OCImage.flags = flags; /* needed for SDL_DOUBLEBUF check */
return ph_SetupOCImage(this, screen);
}
else if(flags & SDL_OPENGL) /* No image when using GL */
else if(flags & SDL_OPENGL)
{
return 0;
return ph_SetupOpenGLImage(this, screen);
}
else
{
Expand Down Expand Up @@ -260,6 +249,13 @@ static PhPoint_t ph_pos;
static PhRect_t ph_rect;
static int i;

void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect* rects)
{
this->GL_SwapBuffers(this);

return;
}

void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects)
{

Expand Down
2 changes: 1 addition & 1 deletion src/video/photon/SDL_ph_image_c.h
Expand Up @@ -39,4 +39,4 @@ extern int ph_FlipHWSurface(_THIS, SDL_Surface *surface);

extern void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects);
extern void ph_OCUpdate(_THIS, int numrects, SDL_Rect *rects);
extern void ph_DummyUpdate(_THIS, int numrects, SDL_Rect *rects);
extern void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect *rects);

0 comments on commit 0448ba7

Please sign in to comment.