|
Size: 1578
Comment: edited text
|
Size: 1640
Comment: Added Version section.
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 30: | Line 30: |
| == Version == This function is available since SDL 2.0.0. |
SDL_GL_SetSwapInterval
Use this function to set the swap interval for the current OpenGL context.
Contents
Syntax
int SDL_GL_SetSwapInterval(int interval)
Function Parameters
interval |
0 for immediate updates, 1 for updates synchronized with the vertical retrace, -1 for late swap tearing; see Remarks |
Return Value
Returns 0 on success or -1 if setting the swap interval is not supported; call SDL_GetError() for more information.
Code Examples
You can add your code example here
Remarks
Some systems allow specifying -1 for the interval, to enable late swap tearing. Late swap tearing works the same as vsync, but if you've already missed the vertical retrace for a given frame, it swaps buffers immediately, which might be less jarring for the user during occasional framerate drops. If application requests late swap tearing and the system does not support it, this function will fail and return -1. In such a case, you should probably retry the call with 1 for the interval.
Late swap tearing is implemented for some glX drivers with GLX_EXT_swap_control_tear and for some Windows drivers with WGL_EXT_swap_control_tear.
Version
This function is available since SDL 2.0.0.
