View Full Version : enable vsync for bufferswapping

12-06-2000, 07:19 AM

I use OpenGl with windows and of course I use doublebuffering. However I have one problem. When I call SwapBuffers it doesnt interest the function to wait until the whole picture has been refreshed. This makes opengl flicker sometimes. I am absolutely sure that I use doublebuffering, so dont tell me to enable this.
Then I found out, that I can force my graphicscard to wait until the screen has been refreshed. Now I dont have this flickering anymore but of course only on my PC. Is there any function to enable this. Or at least is there any function which tells me wether the screen has been refreshed or not?

Thank you.

12-06-2000, 07:28 AM
The feature you are referring to is call "Sync to vertical blank". There is no inherent GL function to turn this on, though many graphics device drivers have the capability to toggle it, using a registry flag.

The flashing occurs when the scene draws more frames than the refresh rate of the monitor. This causes tearing. That said, if you would like to implement a method to prevent this phenomenon, you need to look at a frame rate limiter.
Rather than update and redraw the scene as fast as the card can process the scene, you limit the update and buffer swap to 60 frames per second (or whatever you like, maybe 30 fps).

Does that help?


12-07-2000, 10:08 AM
Thank you. IŽll try this method. However I really think someone should write such a function.

12-07-2000, 10:37 AM
I'll get right on that. </sarcasm>



12-07-2000, 10:59 AM
There is an extension to OpenGL that lets you control the frame swap.

It's called WGL_EXT_swap_control. Many video cards support it. You can find more info at http://oss.sgi.com/projects/ogl-sample/registry/EXT/wgl_swap_control.txt


[This message has been edited by j (edited 12-07-2000).]