View Full Version : Weird issue with SwapBuffers()

03-20-2002, 09:41 PM
I'm in the middle (or past middle) of writing a video game under OpenGL for the Windows Platform. I'm using VC++ 5, and Win98SE.

I'm using fullscreen, and the problem I'm having is that the video almost seems like it isn't actually swapping the buffers, or the OpenGL is rendering to the current screen. I get frames where it seems that instead of drawing the new frame, it is displaying the old one from the last swap before (or at least parts of it). The end effect is that it looks like a ship sometimes is jumping backwards (it's not every other frame, it's like every 4th frame). On an Nvidia card, it is dealable visually, on a 3DFX card, it looks like it draws only part of the gl commands and gives up and displays the frame anyway, even though it isn't done (So I'll get the backdrop, and perhaps some effects, but no ships). I have no clue what is going on.

I have tried glFinish() and glFlush() (even in multiple places, same problem).

Any suggestions?

03-23-2002, 03:42 AM
What i think is you try this
*when u call drawGLScene() set a boolean variable bRendering = TRUE. & after calling SwapBuffers() at the end of drawGLScene() set bRendering = FALSE.
*if (bRendering == TRUE) don't call DrawGLScene()

03-23-2002, 05:00 AM
Do you clear the color buffer each frame? If not, then make sure that you arent doing some type of alpha blend where you blend with the frame buffer (which would likely contain the contents of the previous frame).

03-23-2002, 05:24 AM
If this is only a problem on 3DFX cards, you may need to get a pointer to wglSwapBuffers and use that instead of SwapBuffers,

wglSwapBuffers = GetProcAddress( hOpenglInst, "wglSwapBuffers" );

where hOpenglInst = LoadLibrary( "3dfxvgl.dll" );

I used to have a Voodoo1 ( and Voodoo 3 ) and the above is what I did. I don't remember if that was required on V3's.

03-23-2002, 05:32 AM
PS. You may need to use wglGetProcAddress rather than GetProcAddress. Also, the 3dfxvgl.dll had a different name at some point.