static int fghIsLegacyContextVersionRequested( void )
{
- return fgState.MajorVersion == 1 && fgState.MinorVersion == 0;
+ return fgState.MajorVersion < 2 || (fgState.MajorVersion == 2 && fgState.MinorVersion <= 1);
}
static int fghIsLegacyContextRequested( void )
/* new context creation */
int attributes[9];
- CreateContextAttribsProc createContextAttribs;
+ CreateContextAttribsProc createContextAttribs = (CreateContextAttribsProc) fghGetProcAddress( "glXCreateContextAttribsARB" );
+
+ /* glXCreateContextAttribsARB not found, yet the user has requested the new context creation */
+ if ( !createContextAttribs && !fghIsLegacyContextRequested() ) {
+ fgWarning( "OpenGL >2.1 context requested but glXCreateContextAttribsARB is not available! Falling back to legacy context creation" );
+ fgState.MajorVersion = 2;
+ fgState.MinorVersion = 1;
+ }
/* If nothing fancy has been required, simply use the old context creation GLX API entry */
- if ( fghIsLegacyContextRequested() )
+ if ( fghIsLegacyContextRequested() || !createContextAttribs )
{
context = glXCreateNewContext( dpy, config, render_type, share_list, direct );
if ( context == NULL ) {
fghFillContextAttributes( attributes );
- createContextAttribs = (CreateContextAttribsProc) fghGetProcAddress( "glXCreateContextAttribsARB" );
- if ( createContextAttribs == NULL ) {
- fgError( "glXCreateContextAttribsARB not found" );
- }
-
context = createContextAttribs( dpy, config, share_list, direct, attributes );
if ( context == NULL ) {
fghContextCreationError();
#if TARGET_HOST_POSIX_X11
static Bool fghWindowIsVisible( Display *display, XEvent *event, XPointer arg)
{
- Window window = arg;
+ Window window = (Window)arg;
return (event->type == MapNotify) && (event->xmap.window == window);
}
#endif
GLboolean gameMode, GLboolean isSubWindow )
{
#if TARGET_HOST_POSIX_X11
- XVisualInfo * visualInfo;
+ XVisualInfo * visualInfo = NULL;
XSetWindowAttributes winAttr;
XTextProperty textProperty;
XSizeHints sizeHints;
XFree(visualInfo);
if( !isSubWindow)
- XPeekIfEvent( fgDisplay.Display, &eventReturnBuffer, &fghWindowIsVisible, window->Window.Handle );
+ XPeekIfEvent( fgDisplay.Display, &eventReturnBuffer, &fghWindowIsVisible, (XPointer)(window->Window.Handle) );
#elif TARGET_HOST_MS_WINDOWS
if( gameMode )
{
/* if in gamemode, query the origin of specified by the -display
- * parameter command line (if any) and offset the upper-left corner
+ * command line parameter (if any) and offset the upper-left corner
* of the window so we create the window on that screen.
* The -display argument doesn't do anything if not trying to enter
* gamemode.
}
{
-#if(WINVER >= 0x0500)
+#if(WINVER >= 0x0500) /* Windows 2000 or later */
DWORD s;
RECT rect;
HMONITOR hMonitor;
rect.left = 0;
rect.top = 0;
- get_display_origin(&rect.left,&rect.top);
- rect.right = fgDisplay.ScreenWidth+rect.left;
- rect.bottom = fgDisplay.ScreenHeight+rect.top;
+ rect.right = fgDisplay.ScreenWidth;
+ rect.bottom = fgDisplay.ScreenHeight;
AdjustWindowRect ( &rect, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN, FALSE );