Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add an option to toggle VSync at runtime, and add an option for adaptive VSync #1908

Open
EliteMasterEric opened this issue Feb 14, 2025 · 2 comments

Comments

@EliteMasterEric
Copy link
Contributor

Currently, VSync is enabled/disable via a window flag, and can currently only be set via a flag in the project settings.

However, from what I've read, there should be no issue with adding a function to allow the application to change the VSync mode.

This would require making this call into its own function, then making that accessible on the Window object (either via a function or a property variable).

if (flags & WINDOW_FLAG_VSYNC) {
SDL_GL_SetSwapInterval (1);
} else {
SDL_GL_SetSwapInterval (0);
}

Adding this feature would enable applications to provide a configuration option for users to enable or disable VSync.

Additionally, while we're at it, we should also add the option to use Adaptive VSync. This is done by passing -1 to the swap interval function, and returns an error if it is not supported (see the SDL documentation). In this case, the option should probably be an enumeration rather than a boolean value.

@ACrazyTown
Copy link
Contributor

There's an open pull request for toggleable vsync: #1698

@dimensionscape
Copy link
Member

Iirc, this caused random crashes on older versions of SDL, and required recreating the window. I do believe that it is fixed in current versions though, so let me give it some testing and see what comes of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants