glfwSwapInterval

Sets the swap interval for the current context.

This function sets the swap interval for the current OpenGL or OpenGL ES context, i.e. the number of screen updates to wait from the time @ref glfwSwapBuffers was called before swapping the buffers and returning. This is sometimes called _vertical synchronization_, _vertical retrace synchronization_ or just _vsync_.

A context that supports either of the WGL_EXT_swap_control_tear and GLX_EXT_swap_control_tear extensions also accepts _negative_ swap intervals, which allows the driver to swap immediately even if a frame arrives a little bit late. You can check for these extensions with @ref glfwExtensionSupported.

A context must be current on the calling thread. Calling this function without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.

This function does not apply to Vulkan. If you are rendering with Vulkan, see the present mode of your swapchain instead.

extern (C) @nogc nothrow __gshared
void
glfwSwapInterval
()

Parameters

interval int

The minimum number of screen updates to wait for until the buffers are swapped by @ref glfwSwapBuffers.

Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.

@remark This function is not called during context creation, leaving the swap interval set to whatever is the default on that platform. This is done because some swap interval extensions used by GLFW do not allow the swap interval to be reset to zero once it has been set to a non-zero value.

@remark Some GPU drivers do not honor the requested swap interval, either because of a user setting that overrides the application's request or due to bugs in the driver.

Thread Safety

This function may be called from any thread.

@sa @ref buffer_swap @sa @ref glfwSwapBuffers

Meta

Since

Added in version 1.0.

Ingroup: context