Wiki Page Content

Differences between revisions 2 and 3
Revision 2 as of 2010-08-30 00:54:39
Size: 781
Editor: SheenaSmith
Comment: remove 'draft' note
Revision 3 as of 2013-08-13 07:45:41
Size: 1510
Editor: RyanGordon
Comment: late swap tearing information
Deletions are marked like this. Additions are marked like this.
Line 15: Line 15:
||'''interval'''||0 for immediate updates, 1 for updates synchronized with the vertical retrace|| ||'''interval'''||0 for immediate updates, 1 for updates synchronized with the vertical retrace, -1 for late swap tearing; see [[#Remarks|Remarks]]||
Line 26: Line 26:
''You can add useful comments here'' Some systems can specify -1 for the interval, which uses late swap tearing. That is to say, it works like specifying a 1, but if you've already missed the vertical retrace for a given frame, it swaps immediately, which for small drops in framerate might be less distracting. If the system can't support late swap tearing, this function will fail. 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 [[http://www.opengl.org/registry/specs/EXT/glx_swap_control_tear.txt|GLX_EXT_swap_control_tear]] and for some Windows drivers with [[http://www.opengl.org/registry/specs/EXT/wgl_swap_control_tear.txt|WGL_EXT_swap_control_tear]].

SDL_GL_SetSwapInterval

Use this function to set the swap interval for the current OpenGL context.

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 can specify -1 for the interval, which uses late swap tearing. That is to say, it works like specifying a 1, but if you've already missed the vertical retrace for a given frame, it swaps immediately, which for small drops in framerate might be less distracting. If the system can't support late swap tearing, this function will fail. 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.


CategoryAPI, CategoryVideo

None: SDL_GL_SetSwapInterval (last edited 2018-04-23 21:33:14 by urkle)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit