Difference between revisions of "Swap Interval"
m (moved SwapInterval aka vsync to Swap Interval: We can use redirects to have vsync point there. No need to put it in the title.)
Revision as of 23:11, 21 November 2009
In Windows, if WGL_EXT_swap_control is present in the string returned by glGetString(GL_EXTENSIONS), then you can use wglSwapIntervalEXT(0) to disable vsync or you can use wglSwapIntervalEXT(1) to enable vsync (aka vertical synchronization).
For historical reasons, WGL_EXT_swap_control is included in the GL_EXTENSIONS string as returned from glGetString.
It is also included in the string returned by wglGetExtensionsStringARB(), which is the more correct place for it.
You should check for the presence in both locations to make sure it is really present. Either place will do.
We should also mention that there are duplicate extensions : WGL_EXT_extensions_string, WGL_ARB_extensions_string.
http://www.opengl.org/registry/specs/EXT/wgl_extensions_string.txt defines wglGetExtensionsStringEXT
http://www.opengl.org/registry/specs/ARB/wgl_extensions_string.txt defines wglGetExtensionsStringARB
Use wglGetExtensionsStringARB. Don't bother with wglGetExtensionsStringEXT.
In Linux, things are much simpler.
If GLX_SGI_swap_control is present in the string returned by glGetString(GL_EXTENSIONS), then you can use glXSwapIntervalSGI(0) to disable vsync or you can use glXSwapIntervalSGI(1) to enable vsync (aka vertical synchronization).
Apparently, an EXT or ARB version has not been created.
The extension doesn't say it but it is assumed that glGetString(GL_EXTENSIONS) returns GLX_SGI_swap_control.
Note : It has been reported that in some case (some driver) with ATI, it doesn't give GLX_SGI_swap_control. It gives WGL_EXT_swap_control yet the driver doesn't export wglSwapIntervalEXT but it does export glXSwapIntervalSGI and it works.
PS : if the driver is configed to ignore application settings, your calls to glXSwapIntervalSGI will get ignored.