OpenGL & Vulkan windowsSDL 3.2

SDL_GL_SetSwapInterval

Turns vsync on or off for the current OpenGL context.

Signature

bool SDL_GL_SetSwapInterval(int interval);

How it works

0 = swap at once, 1 = wait for the monitor's refresh, -1 = adaptive (like 1, but a late frame is shown at once to avoid a stutter). Adaptive is not available everywhere: if it fails, fall back to 1.

Parameters

intervalint

0, 1, or -1 (adaptive).

Return value

true on success; false if this interval is not supported.

Example

example.cpp
Official SDL wiki