Skip to content

Commit

Permalink
Added QNX cleanups by Mike Gorchak (thanks!)
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 18, 2002
1 parent 56fe55f commit 230e852
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 329 deletions.
19 changes: 19 additions & 0 deletions README.QNX
@@ -0,0 +1,19 @@
README by Mike Gorchak <mike@malva.com.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 is very
raw. It is often fail.

Some building issues:

Run configure script without x11 support, e.g.:

./configure --prefix=/usr/local --disable-video-x11

In test directory also run ./configure script without x11 support, e.g.:

./configure --with-sdl-prefix=/usr/local \
--with-sdl-exec-prefix=/usr/local \
--prefix=/usr/local --without-x
4 changes: 3 additions & 1 deletion src/video/SDL_video.c
Expand Up @@ -1391,7 +1391,9 @@ void SDL_GL_SwapBuffers(void)
SDL_VideoDevice *this = current_video;

if ( video->screen->flags & SDL_OPENGL ) {
video->GL_SwapBuffers( this );
video->GL_SwapBuffers(this);
} else {
SDL_SetError("OpenGL video mode has not been set");
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/video/photon/SDL_ph_events.c
Expand Up @@ -55,9 +55,10 @@ SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym);
(idea shamelessly lifted from GII -- thanks guys! :)
*/

/*
static int ph_KeyRepeat(_THIS, PhKeyEvent_t* keyevent)
{
PhEvent_t* peekevent;
// PhEvent_t* peekevent;
PhKeyEvent_t* keyEvent;
int repeated;
Expand All @@ -84,11 +85,13 @@ static int ph_KeyRepeat(_THIS, PhKeyEvent_t* keyevent)
}
break;
default: /* no events pending */
default: // no events pending
}
return(repeated);
}
*/

/* Note: The X server buffers and accumulates mouse motion events, so
the motion event generated by the warp may not appear exactly as we
expect it to. We work around this (and improve performance) by only
Expand Down Expand Up @@ -118,7 +121,7 @@ static inline int X11_WarpedMotion(_THIS, XEvent *xevent)
(xevent->xmotion.x > (w-MOUSE_FUDGE_FACTOR)) ||
(xevent->xmotion.y < MOUSE_FUDGE_FACTOR) ||
(xevent->xmotion.y > (h-MOUSE_FUDGE_FACTOR)) ) {
/* Get the events that have accumulated */
// Get the events that have accumulated
/* while ( XCheckTypedEvent(SDL_Display, MotionNotify, xevent) ) {
deltax = xevent->xmotion.x - mouse_last.x;
deltay = xevent->xmotion.y - mouse_last.y;
Expand Down Expand Up @@ -161,6 +164,7 @@ static inline int X11_WarpedMotion(_THIS, XEvent *xevent)

/* Control which motion flags the window has set, a flags value of -1 sets
* MOTION_BUTTON and MOTION_NOBUTTON */

static void set_motion_sensitivity(_THIS, unsigned int flags)
{
int rid, fields = Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON;
Expand Down
58 changes: 24 additions & 34 deletions src/video/photon/SDL_ph_image.c
Expand Up @@ -129,24 +129,24 @@ int ph_SetupOCImage(_THIS, SDL_Surface *screen) //Offscreen context
break;
}

OCImage.FrameData0 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA)));
OCImage.FrameData1 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA)));
OCImage.FrameData0 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA)));
OCImage.FrameData1 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA)));

if(OCImage.direct_context == NULL)
OCImage.direct_context = PdCreateDirectContext();
OCImage.direct_context = PdCreateDirectContext();

OCImage.offscreen_context = PdCreateOffscreenContext(0,screen->w,screen->h, Pg_OSC_MEM_PAGE_ALIGN);
OCImage.offscreen_context = PdCreateOffscreenContext(0,screen->w,screen->h, Pg_OSC_MEM_PAGE_ALIGN);

if (OCImage.offscreen_context == NULL)
{
printf("PdCreateOffscreenContext failed\n");
return -1;
}
if (OCImage.offscreen_context == NULL)
{
printf("PdCreateOffscreenContext failed\n");
return -1;
}

OCImage.Stride = OCImage.offscreen_context->pitch;
OCImage.Stride = OCImage.offscreen_context->pitch;

if (OCImage.flags & SDL_DOUBLEBUF)
printf("hardware flag for doublebuf offscreen context\n");
if (OCImage.flags & SDL_DOUBLEBUF)
printf("hardware flag for doublebuf offscreen context\n");


OCImage.dc_ptr.ptr8 = (unsigned char *) PdGetOffscreenContextPtr(OCImage.offscreen_context);
Expand Down Expand Up @@ -175,21 +175,18 @@ int ph_SetupOCImage(_THIS, SDL_Surface *screen) //Offscreen context

void ph_DestroyImage(_THIS, SDL_Surface *screen)
{


if(SDL_Image == NULL)
return;

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->image)
{
Expand All @@ -210,7 +207,6 @@ void ph_DestroyImage(_THIS, SDL_Surface *screen)

int ph_ResizeImage(_THIS, SDL_Surface *screen, Uint32 flags)
{

ph_DestroyImage(this, screen);

if( flags & SDL_HWSURFACE)
Expand All @@ -226,30 +222,25 @@ int ph_ResizeImage(_THIS, SDL_Surface *screen, Uint32 flags)
{
return ph_SetupImage(this, screen);
}

}

int ph_AllocHWSurface(_THIS, SDL_Surface *surface)
{

return(-1);
}

void ph_FreeHWSurface(_THIS, SDL_Surface *surface)
{

return;
}

int ph_FlipHWSurface(_THIS, SDL_Surface *surface)
{

return(0);
}

int ph_LockHWSurface(_THIS, SDL_Surface *surface)
{

if ( (surface == SDL_VideoSurface) && blit_queued ) {
// XSync(GFX_Display, False);
PgFlush();
Expand All @@ -260,7 +251,6 @@ int ph_LockHWSurface(_THIS, SDL_Surface *surface)

void ph_UnlockHWSurface(_THIS, SDL_Surface *surface)
{

return;
}

Expand Down Expand Up @@ -290,7 +280,7 @@ void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects)
}
}
if (PgFlush() < 0)
{
{
fprintf(stderr,"error: PgFlush failed.\n");
}
}
Expand Down Expand Up @@ -326,13 +316,13 @@ void ph_OCUpdate(_THIS, int numrects, SDL_Rect *rects)

zero.x = zero.y = 0;
PgSetTranslation (&zero, 0);
PgSetRegion(PtWidgetRid(window));
PgSetRegion(PtWidgetRid(window));
PgSetClipping(0,NULL);
PgContextBlitArea(OCImage.offscreen_context, (PhArea_t *)(&src_rect), NULL, (PhArea_t *)(&dest_rect));

}
if (PgFlush() < 0)
{
{
fprintf(stderr,"error: PgFlush failed.\n");
}

Expand Down

0 comments on commit 230e852

Please sign in to comment.