Single buffered rendering for Windows.
authorDon Heyse <dheyse@hotmail.com>
Thu, 12 Jun 2003 18:52:37 +0000 (18:52 +0000)
committerDon Heyse <dheyse@hotmail.com>
Thu, 12 Jun 2003 18:52:37 +0000 (18:52 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@60 7f0cb862-5218-0410-a997-914c9d46530a

freeglut-1.3/freeglut_display.c
freeglut-1.3/freeglut_internal.h
freeglut-1.3/freeglut_window.c

index 7f7e3c1..900b9d0 100644 (file)
@@ -74,12 +74,12 @@ void FGAPIENTRY glutSwapBuffers( void )
      */
     glFlush();
 
-#if TARGET_HOST_UNIX_X11
     /*
      * If it's single-buffered, we shouldn't be here.
      */
     if ( ! fgStructure.Window->Window.DoubleBuffered ) return ;
 
+#if TARGET_HOST_UNIX_X11
     /*
      * Issue the glXSwapBuffers call and be done with it
      */
index e60d783..bb93080 100644 (file)
@@ -291,7 +291,6 @@ struct tagSFG_Context
     Window          Handle;             /* The window's handle                 */
     GLXContext      Context;            /* The OpenGL context                  */
     XVisualInfo*    VisualInfo;         /* The window's visual information     */
-    int             DoubleBuffered;     /* Treat the window as double-buffered */
 
 #elif TARGET_HOST_WIN32
     HWND            Handle;             /* The window's handle                 */
@@ -299,6 +298,8 @@ struct tagSFG_Context
     HGLRC           Context;            /* The window's WGL context            */
 
 #endif
+
+    int             DoubleBuffered;     /* Treat the window as double-buffered */
 };
 
 /*
index 7d67b61..7bd5700 100644 (file)
@@ -361,11 +361,6 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
     freeglut_assert_ready;
 
     /*
-     * Save the window's single- or double-buffering state
-     */
-    window->Window.DoubleBuffered = ( fgState.DisplayMode & GLUT_DOUBLE ) ? 1 : 0 ;
-
-    /*
      * Here we are upon the stage. Have the visual selected.
      */
     window->Window.VisualInfo = fgChooseVisual();
@@ -541,15 +536,6 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
 #       endif
     }
 
-    /*
-     * If it's not double-buffered, make sure the rendering is done to the front buffer.
-     */
-    if ( ! window->Window.DoubleBuffered )
-    {
-      glDrawBuffer ( GL_FRONT ) ;
-      glReadBuffer ( GL_FRONT ) ;
-    }
-
 #elif TARGET_HOST_WIN32
 
        WNDCLASS wc;
@@ -637,6 +623,20 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
 #endif
 
     /*
+     * Save the window's single- or double-buffering state
+     */
+    window->Window.DoubleBuffered = ( fgState.DisplayMode & GLUT_DOUBLE ) ? 1 : 0 ;
+
+    /*
+     * If it's not double-buffered, make sure the rendering is done to the front buffer.
+     */
+    if ( ! window->Window.DoubleBuffered )
+    {
+      glDrawBuffer ( GL_FRONT ) ;
+      glReadBuffer ( GL_FRONT ) ;
+    }
+
+    /*
      * Set the newly created window as the current one
      */
     fgSetWindow( window );