, 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). <br> |+|
historical reasons, WGL_EXT_swap_control is included in the GL_EXTENSIONS string as returned from glGetString. <br> |+|
|−|http://www. opengl. org/registry/specs/EXT/wgl_swap_control. txt<br> |+|
|−|It is also included in the string returned by wglGetExtensionsStringARB(), which is the more correct place for it. <br> |+|
|−|You should check for the presence in both locations to make sure it is really present. Either place will do.<br> |+|
|−|We should also mention that there are duplicate extensions : WGL_EXT_extensions_string, WGL_ARB_extensions_string.<br> |+|
wgl_extensions_string.txt defines wglGetExtensionsStringEXT<br> |+|
ARB/ wgl_extensions_string.txt defines wglGetExtensionsStringARB<br> |+|
WGL_EXT_swap_control the string glGetString(GL_EXTENSIONS)
|−|Use wglGetExtensionsStringARB. Don't bother with wglGetExtensionsStringEXT.<br> |+|
, wglSwapIntervalEXT(0) to disable vsync
|−|In Linux, things are much simpler.<br> |+|
|−|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).<br> |+|
|−|Apparently, an EXT or ARB version has not been created.<br> |+|
swap_control.txt <br> |+|
|−|The extension doesn't say it but it is assumed that glGetString(GL_EXTENSIONS) returns GLX_SGI_swap_control.<br> |+|
(1) to enable vsync()
|−|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.<br> |+|
For , is in .
. . . the , the . to .
When using double-buffered OpenGL, Swap Interval is a means of synchronizing the swapping of front and back frame buffers with a video card's vertical blanking period, AKA Vsync.
The term "swap interval" itself refers to the number of vblank periods that must occur between buffer swaps. A swap interval of 1 specifies that at the very least, the GPU must wait for a single vblank before swapping the front and back buffers. A swap interval of 0 specifies that the GPU should not wait for any vblanks, thus perform buffer swaps immediately.
Application control of swap interval is provided via platform-specific extensions.
Use the WGL_EXT_swap_control extension to control swap interval. Check both the standard extensions string via glGetString(GL_EXTENSIONS) and the WGL-specific extensions string via wglGetExtensionsStringARB() to verify that WGL_EXT_swap_control is actually present.
The extension provides the wglSwapIntervalEXT() function, which directly specifies the swap interval. (e.g. wglSwapIntervalEXT(1) to enable vsync; wglSwapIntervalEXT(0) to disable vsync)
In Linux / GLX
Use the GLX_SGI_swap_control extension to control swap interval. Check both the standard extensions string via glGetString(GL_EXTENSIONS) and the GLX-specific extensions string via glXQueryExtensionsString() to verify that the extension is actually present.
The extension provides glxSwapIntervalSGI(), which also directly specifies the swap interval. (e.g. glxSwapIntervalSGI(1) to enable vsync; glxSwapIntervalSGI(0) to disable vsync)
- Some ATI GLX drivers may report WGL_EXT_swap_control yet actually export glxSwapIntervalSGI.
- Your application's use of swap interval may be overridden by external, driver-specific configuration. For example, forcing Vsync Off in a driver's control panel will prevent Vsync, even if swap interval is set to 1 in your application.
- If swap interval is non-zero, drivers traditionally caused the calling thread to block SwapBuffers until the actual buffer swap was completed. In more recent drivers, the block occurs on the GPU, allowing the application thread to continue execution and even render and enqueue subsequent frames before the first swap occurs. This behavior could cause significant transport delay if the application expects traditional behavior. If the application requires either more deterministic behavior associated with vblank or minimal transport delay, the GLX_SGI_video_sync extension can be used in conjunction with swap interval. GLX_SGI_video_sync provides a method to synchronize CPU thread execution to vblank.