Implementing Stereo in Windows
[freeglut] / src / freeglut_window.c
index 277fe26..af29425 100644 (file)
@@ -184,6 +184,9 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
     if( fgState.DisplayMode & GLUT_DOUBLE )
         flags |= PFD_DOUBLEBUFFER;
 
+    if( fgState.DisplayMode & GLUT_STEREO )
+        flags |= PFD_STEREO;
+
 #if defined(_MSC_VER)
 #pragma message( "fgSetupPixelFormat(): there is still some work to do here!" )
 #endif
@@ -380,14 +383,14 @@ void fgOpenWindow( SFG_Window* window, const char* title,
         {
             fgStructure.MenuContext =
                 (SFG_MenuContext *)malloc( sizeof(SFG_MenuContext) );
-            fgStructure.MenuContext->VisualInfo = window->Window.VisualInfo;
-            fgStructure.MenuContext->Context = glXCreateContext(
-                fgDisplay.Display, fgStructure.MenuContext->VisualInfo,
+            fgStructure.MenuContext->MVisualInfo = window->Window.VisualInfo;
+            fgStructure.MenuContext->MContext = glXCreateContext(
+                fgDisplay.Display, fgStructure.MenuContext->MVisualInfo,
                 NULL, ( fgState.DirectContext != GLUT_FORCE_INDIRECT_CONTEXT )
             );
         }
 
-        /* window->Window.Context = fgStructure.MenuContext->Context; */
+        /* window->Window.Context = fgStructure.MenuContext->MContext; */
         window->Window.Context = glXCreateContext(
             fgDisplay.Display, window->Window.VisualInfo,
             NULL, ( fgState.DirectContext != GLUT_FORCE_INDIRECT_CONTEXT )
@@ -462,6 +465,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
         &wmHints,
         NULL
     );
+    XFree( textProperty.value );
 
     XSetWMProtocols( fgDisplay.Display, window->Window.Handle,
                      &fgDisplay.DeleteWindow, 1 );
@@ -617,6 +621,7 @@ void fgCloseWindow( SFG_Window* window )
 #if TARGET_HOST_UNIX_X11
 
     glXDestroyContext( fgDisplay.Display, window->Window.Context );
+    XFree( window->Window.VisualInfo );
     XDestroyWindow( fgDisplay.Display, window->Window.Handle );
     XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */