Added GLUT_AUX and GLUT_MULTISAMPLE as possible parameters for
[freeglut] / src / freeglut_window.c
index bce206e..cc73b88 100644 (file)
@@ -306,9 +306,10 @@ void fgNewWGLCreateContext( SFG_Window* window )
     HGLRC context;
     int attribs[7];
     PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
+    const char * pWglExtString;
 
-    if( (fgState.ContextFlags & GLUT_FORWARD_COMPATIBLE) &&
-        (fgState.MajorVersion > 2) )
+    /* If nothing fancy has been required, leave the context as it is */
+    if ( fgState.MajorVersion == 1 && fgState.MinorVersion == 0 && fgState.ContextFlags == 0 )
     {
         return;
     }
@@ -322,7 +323,7 @@ void fgNewWGLCreateContext( SFG_Window* window )
         return;
     }
 
-    const char * pWglExtString=wglGetEntensionsStringARB(window->Window.Device);
+    pWglExtString=wglGetEntensionsStringARB(window->Window.Device);
     if (( pWglExtString == NULL ) || ( strstr(pWglExtString, "WGL_ARB_create_context") == NULL ))
     {
         return;
@@ -1024,7 +1025,8 @@ void fgCloseWindow( SFG_Window* window )
 {
 #if TARGET_HOST_POSIX_X11
 
-    glXDestroyContext( fgDisplay.Display, window->Window.Context );
+    if( window->Window.Context )
+        glXDestroyContext( fgDisplay.Display, window->Window.Context );
     XFree( window->Window.FBConfig );
     XDestroyWindow( fgDisplay.Display, window->Window.Handle );
     /* XFlush( fgDisplay.Display ); */ /* XXX Shouldn't need this */