Mike Gorchak added some QNX tweaks, including OpenGL support
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40280
This commit is contained in:
parent
7dffe66c0f
commit
e7866b627d
4 changed files with 95 additions and 88 deletions
7
BUGS
7
BUGS
|
@ -190,10 +190,6 @@ AIX: -= NOT YET SUPPORTED =-
|
|||
http://www.kom.e-technik.tu-darmstadt.de/~griff/SDL/
|
||||
|
||||
QNX: -= NOT YET SUPPORTED =-
|
||||
Configuration doesn't work right, Makefiles still need to be
|
||||
tweaked (need to add libraries to any apps that use sdl_config
|
||||
to figure out what libs they need).
|
||||
|
||||
Only static libraries are being made, no shared ones.
|
||||
|
||||
The only hardware surface is the primary view surface.
|
||||
|
@ -204,9 +200,6 @@ QNX: -= NOT YET SUPPORTED =-
|
|||
|
||||
The software surfaces could use some speed up.
|
||||
|
||||
It doesn't look like the OpenGL stuff is there. (did a grep for
|
||||
PdCreateOpenGLContext, nothing found).
|
||||
|
||||
The mouse cursor doesn't look right.
|
||||
|
||||
AmigaOS: -= NOT YET SUPPORTED =-
|
||||
|
|
23
README.QNX
23
README.QNX
|
@ -3,17 +3,34 @@ 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.
|
||||
versions of OS before 6.1.0 is not supported.
|
||||
|
||||
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.
|
||||
|
||||
Some building issues:
|
||||
|
||||
Run configure script without x11 support, e.g.:
|
||||
|
||||
./configure --prefix=/usr/local --disable-video-x11
|
||||
a) for OpenGL support:
|
||||
./configure --prefix=/usr/local \
|
||||
--disable-video-x11 \
|
||||
--disable-shared
|
||||
|
||||
a) without OpenGL support:
|
||||
./configure --prefix=/usr/local \
|
||||
--disable-video-x11 \
|
||||
--disable-shared \
|
||||
--disable-video-opengl
|
||||
|
||||
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
|
||||
|
||||
|
|
23
configure.in
23
configure.in
|
@ -647,6 +647,7 @@ CheckX11()
|
|||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
CheckPHOTON()
|
||||
{
|
||||
AC_ARG_ENABLE(video-photon,
|
||||
|
@ -671,6 +672,7 @@ CheckPHOTON()
|
|||
SYSTEM_LIBS="$SYSTEM_LIBS -lph"
|
||||
VIDEO_SUBDIRS="$VIDEO_SUBDIRS photon"
|
||||
VIDEO_DRIVERS="$VIDEO_DRIVERS photon/libvideo_photon.la"
|
||||
CheckOpenGLQNX
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -947,6 +949,26 @@ CheckOpenGL()
|
|||
fi
|
||||
}
|
||||
|
||||
dnl Find QNX RtP OpenGL
|
||||
CheckOpenGLQNX()
|
||||
{
|
||||
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
|
||||
AC_MSG_CHECKING(for OpenGL (Photon) support)
|
||||
video_opengl=no
|
||||
AC_TRY_COMPILE([
|
||||
#include <GL/gl.h>
|
||||
],[
|
||||
],[
|
||||
video_opengl=yes
|
||||
])
|
||||
AC_MSG_RESULT($video_opengl)
|
||||
if test x$video_opengl = xyes; then
|
||||
CFLAGS="$CFLAGS -DHAVE_OPENGL"
|
||||
SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
dnl Check for BeOS OpenGL
|
||||
CheckBeGL()
|
||||
{
|
||||
|
@ -2162,6 +2184,7 @@ AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
|
|||
AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
|
||||
AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
|
||||
AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
|
||||
AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx)
|
||||
|
||||
# Set conditional variables for shared and static library selection.
|
||||
# These are not used in any Makefile.am but in sdl-config.in.
|
||||
|
|
|
@ -58,7 +58,9 @@ static void ph_VideoQuit(_THIS);
|
|||
static void ph_DeleteDevice(SDL_VideoDevice *device);
|
||||
static void ph_GL_SwapBuffers(_THIS);
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
PdOpenGLContext_t* OGLContext=NULL;
|
||||
#endif /* HAVE_OPENGL */
|
||||
|
||||
static int ph_Available(void)
|
||||
{
|
||||
|
@ -85,7 +87,7 @@ static SDL_VideoDevice *ph_CreateDevice(int devindex)
|
|||
memset(device->hidden, 0, (sizeof *device->hidden));
|
||||
|
||||
/* Set the driver flags */
|
||||
device->handles_any_size = 1; //JB not true for fullscreen
|
||||
device->handles_any_size = 1; /* JB not true for fullscreen */
|
||||
|
||||
/* Set the function pointers */
|
||||
device->CreateYUVOverlay = ph_CreateYUVOverlay;
|
||||
|
@ -95,7 +97,7 @@ static SDL_VideoDevice *ph_CreateDevice(int devindex)
|
|||
device->ToggleFullScreen = ph_ToggleFullScreen;
|
||||
device->UpdateMouse = NULL;
|
||||
device->SetColors = ph_SetColors;
|
||||
device->UpdateRects = NULL; //set in ph_ResizeImage
|
||||
device->UpdateRects = NULL; /* ph_ResizeImage; */
|
||||
device->VideoQuit = ph_VideoQuit;
|
||||
device->AllocHWSurface = ph_AllocHWSurface;
|
||||
device->CheckHWBlit = NULL;
|
||||
|
@ -119,12 +121,16 @@ static SDL_VideoDevice *ph_CreateDevice(int devindex)
|
|||
device->InitOSKeymap = ph_InitOSKeymap;
|
||||
device->PumpEvents = ph_PumpEvents;
|
||||
|
||||
// OpenGL support.
|
||||
/* OpenGL support. */
|
||||
device->GL_LoadLibrary = NULL;
|
||||
device->GL_GetProcAddress = NULL;
|
||||
device->GL_GetAttribute = NULL;
|
||||
device->GL_MakeCurrent = NULL;
|
||||
#ifdef HAVE_OPENGL
|
||||
device->GL_SwapBuffers = ph_GL_SwapBuffers;
|
||||
#else
|
||||
device->GL_SwapBuffers = NULL;
|
||||
#endif /* HAVE_OPENGL */
|
||||
|
||||
device->free = ph_DeleteDevice;
|
||||
|
||||
|
@ -196,7 +202,6 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
|||
{
|
||||
printf("Photon application init failed, probably Photon is not running.\n");
|
||||
exit( EXIT_FAILURE );
|
||||
// PtExit(EXIT_FAILURE); // Got SEGFAULT.
|
||||
}
|
||||
|
||||
//PgSetDrawBufferSize(16 *1024);
|
||||
|
@ -216,29 +221,21 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
|||
|
||||
if(SDL_BlankCursor == NULL)
|
||||
printf("could not create blank cursor\n");
|
||||
/* Get the video mode */
|
||||
/*
|
||||
if (PgGetVideoMode( &mysettings ) < 0)
|
||||
{
|
||||
fprintf(stderr,"ph_VideoInit: PgGetVideoMode failed patch A?? \n");
|
||||
//QNX6/Patch A always fails return code even though call succeeds. fixed Patch B
|
||||
}
|
||||
*/
|
||||
|
||||
if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
|
||||
{
|
||||
fprintf(stderr,"ph_VideoInit: GetGraphicsHWCaps failed!! \n");
|
||||
//that HAVE to work
|
||||
}
|
||||
if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &my_mode_info) < 0)
|
||||
{
|
||||
fprintf(stderr,"ph_VideoInit: PgGetVideoModeInfo failed\n");
|
||||
}
|
||||
|
||||
//We need to return BytesPerPixel as it in used by CreateRGBsurface
|
||||
vformat->BitsPerPixel = my_mode_info.bits_per_pixel;
|
||||
vformat->BytesPerPixel = vformat->BitsPerPixel/8;
|
||||
|
||||
//return a palette if we are in 256 color mode
|
||||
//We need to return BytesPerPixel as it in used by CreateRGBsurface
|
||||
vformat->BitsPerPixel = my_mode_info.bits_per_pixel;
|
||||
vformat->BytesPerPixel = my_mode_info.bytes_per_scanline/my_mode_info.width;
|
||||
|
||||
//return a palette if we are in 256 color mode
|
||||
if(vformat->BitsPerPixel == 8)
|
||||
{
|
||||
vformat->palette = malloc(sizeof(SDL_Palette));
|
||||
|
@ -251,7 +248,7 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
|||
if(rtnval < 0)
|
||||
printf("ph_VideoInit: PgGetPalette failed\n");
|
||||
|
||||
tempptr = (unsigned long *)vformat->palette->colors;
|
||||
tempptr = (unsigned long *)vformat->palette->colors;
|
||||
|
||||
for(i=0;i<256; i++)
|
||||
{
|
||||
|
@ -273,10 +270,11 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
|||
static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
int width, int height, int bpp, Uint32 flags)
|
||||
{
|
||||
// PhRegion_t region_info;
|
||||
PgDisplaySettings_t settings;
|
||||
/*
|
||||
PgHWCaps_t my_hwcaps;
|
||||
PgVideoModeInfo_t mode_info;
|
||||
*/
|
||||
int mode, actual_width, actual_height;
|
||||
PtArg_t arg[5];
|
||||
PhDim_t dim;
|
||||
|
@ -284,7 +282,10 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
|
|||
PgColor_t ph_palette[_Pg_MAX_PALETTE];
|
||||
int i;
|
||||
unsigned long *tempptr;
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS];
|
||||
#endif // HAVE_OPENGL
|
||||
|
||||
actual_width = width;
|
||||
actual_height = height;
|
||||
|
@ -296,37 +297,9 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
|
|||
SDL_Lock_EventThread();
|
||||
|
||||
/* Initialize the window */
|
||||
if (flags & SDL_FULLSCREEN) //Direct Context , assume SDL_HWSURFACE also set
|
||||
if (flags & SDL_FULLSCREEN) /* Direct Context , assume SDL_HWSURFACE also set */
|
||||
{
|
||||
/*
|
||||
if (old_video_mode==-1)
|
||||
{
|
||||
PgGetGraphicsHWCaps(&graphics_card_caps);
|
||||
old_video_mode=graphics_card_caps.current_video_mode;
|
||||
old_refresh_rate=graphics_card_caps.current_rrate;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Get the video mode and set it */
|
||||
if (bpp == 0)
|
||||
{
|
||||
/*again same issue, same solution
|
||||
if (PgGetVideoMode( &settings ) < 0)
|
||||
{
|
||||
fprintf(stderr,"error: PgGetVideoMode failed\n");
|
||||
}
|
||||
*/
|
||||
if (PgGetGraphicsHWCaps(&my_hwcaps) < 0)
|
||||
{
|
||||
fprintf(stderr,"ph_SetVideoMode: GetGraphicsHWCaps failed!! \n");
|
||||
//that HAVE to work
|
||||
}
|
||||
if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &mode_info) < 0)
|
||||
{
|
||||
fprintf(stderr,"ph_SetVideoMode: PgGetVideoModeInfo failed\n");
|
||||
}
|
||||
bpp = mode_info.bits_per_pixel;
|
||||
}
|
||||
if (flags & SDL_ANYFORMAT)
|
||||
{
|
||||
if ((mode = get_mode_any_format(width, height, bpp)) == 0)
|
||||
|
@ -356,27 +329,28 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
|
|||
|
||||
/* Get the true height and width */
|
||||
|
||||
current->flags = (flags|(~SDL_RESIZABLE)); //no resize for Direct Context
|
||||
current->flags = (flags|(~SDL_RESIZABLE)); /* no resize for Direct Context */
|
||||
|
||||
/* Begin direct mode */
|
||||
ph_EnterFullScreen(this);
|
||||
|
||||
|
||||
|
||||
} //end fullscreen flag
|
||||
} /* end fullscreen flag */
|
||||
else
|
||||
{
|
||||
if (flags & SDL_HWSURFACE) /* Use offscreen memory iff SDL_HWSURFACE flag is set */
|
||||
{
|
||||
// Hardware surface is Offsceen Context. ph_ResizeImage handles the switch
|
||||
current->flags = (flags|(~SDL_RESIZABLE)); //no stretch blit in offscreen context
|
||||
/* Hardware surface is Offsceen Context. ph_ResizeImage handles the switch */
|
||||
current->flags = (flags|(~SDL_RESIZABLE)); /* no stretch blit in offscreen context */
|
||||
}
|
||||
else // must be SDL_SWSURFACE
|
||||
else /* must be SDL_SWSURFACE */
|
||||
{
|
||||
current->flags = (flags|SDL_RESIZABLE); //yes we can resize as this is a software surface
|
||||
current->flags = (flags|SDL_RESIZABLE); /* yes we can resize as this is a software surface */
|
||||
}
|
||||
|
||||
if (flags & SDL_OPENGL) // for now support OpenGL in window mode only
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
if (flags & SDL_OPENGL) /* for now support OpenGL in window mode only */
|
||||
{
|
||||
OGLAttrib[0]=PHOGL_ATTRIB_DEPTH_BITS;
|
||||
OGLAttrib[1]=bpp;
|
||||
|
@ -389,17 +363,18 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
|
|||
}
|
||||
PhDCSetCurrent(OGLContext);
|
||||
}
|
||||
#endif /* HAVE_OPENGL */
|
||||
|
||||
}
|
||||
|
||||
//If we are setting video to use the palette make sure we have allocated memory for it
|
||||
/* If we are setting video to use the palette make sure we have allocated memory for it */
|
||||
if(bpp == 8)
|
||||
{
|
||||
current->format->palette = malloc(sizeof(SDL_Palette));
|
||||
memset(current->format->palette, 0, sizeof(SDL_Palette));
|
||||
current->format->palette->ncolors = 256;
|
||||
current->format->palette->colors = (SDL_Color *)malloc(256 *sizeof(SDL_Color));
|
||||
//fill the palette
|
||||
/* fill the palette */
|
||||
rtnval = PgGetPalette(ph_palette);
|
||||
|
||||
tempptr = (unsigned long *)current->format->palette->colors;
|
||||
|
@ -413,10 +388,10 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
|
|||
}
|
||||
|
||||
|
||||
//Current window dimensions
|
||||
/* Current window dimensions */
|
||||
PtGetResource( window, Pt_ARG_DIM, &dim, 0 );
|
||||
|
||||
//If we need to resize the window
|
||||
|
||||
/* If we need to resize the window */
|
||||
if((dim.w != width)||(dim.h != height))
|
||||
{
|
||||
dim.w=width;
|
||||
|
@ -426,13 +401,12 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
|
|||
current->w = width;
|
||||
current->h = height;
|
||||
current->format->BitsPerPixel = bpp;
|
||||
current->format->BytesPerPixel = bpp/8;
|
||||
current->format->BytesPerPixel = (bpp+7)/8;
|
||||
current->pitch = SDL_CalculatePitch(current);
|
||||
//Must call at least once it setup image planes
|
||||
/* Must call at least once it setup image planes */
|
||||
ph_ResizeImage(this, current, flags);
|
||||
}
|
||||
|
||||
|
||||
SDL_Unlock_EventThread();
|
||||
|
||||
/* We're done! */
|
||||
|
@ -441,20 +415,18 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
|
|||
|
||||
static void ph_VideoQuit(_THIS)
|
||||
{
|
||||
|
||||
if(SDL_Image != NULL)
|
||||
{
|
||||
ph_DestroyImage(this, SDL_VideoSurface);
|
||||
}
|
||||
if (SDL_Image != NULL)
|
||||
{
|
||||
ph_DestroyImage(this, SDL_VideoSurface);
|
||||
}
|
||||
|
||||
if (currently_fullscreen)
|
||||
{
|
||||
PdDirectStop( directContext );
|
||||
PdReleaseDirectContext( directContext );
|
||||
directContext=0;
|
||||
currently_fullscreen = 0;
|
||||
}
|
||||
|
||||
if (currently_fullscreen)
|
||||
{
|
||||
PdDirectStop( directContext );
|
||||
PdReleaseDirectContext( directContext );
|
||||
directContext=0;
|
||||
currently_fullscreen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -516,11 +488,13 @@ static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
|
|||
return alloct_all;
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
void ph_GL_SwapBuffers(_THIS)
|
||||
{
|
||||
PgSetRegion(PtWidgetRid(window));
|
||||
PdOpenGLContextSwapBuffers(OGLContext);
|
||||
}
|
||||
#endif // HAVE_OPENGL
|
||||
|
||||
/*
|
||||
static int ph_ResizeWindow(_THIS,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue