From: Don Heyse Date: Thu, 12 Jun 2003 18:52:37 +0000 (+0000) Subject: Single buffered rendering for Windows. X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=983fc4add0fde87b13543e2ce7d894101ebcee41;p=freeglut Single buffered rendering for Windows. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@60 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/freeglut-1.3/freeglut_display.c b/freeglut-1.3/freeglut_display.c index 7f7e3c1..900b9d0 100644 --- a/freeglut-1.3/freeglut_display.c +++ b/freeglut-1.3/freeglut_display.c @@ -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 */ diff --git a/freeglut-1.3/freeglut_internal.h b/freeglut-1.3/freeglut_internal.h index e60d783..bb93080 100644 --- a/freeglut-1.3/freeglut_internal.h +++ b/freeglut-1.3/freeglut_internal.h @@ -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 */ }; /* diff --git a/freeglut-1.3/freeglut_window.c b/freeglut-1.3/freeglut_window.c index 7d67b61..7bd5700 100644 --- a/freeglut-1.3/freeglut_window.c +++ b/freeglut-1.3/freeglut_window.c @@ -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 );