Skip to content

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

Open
@EliteMasterEric

Description

@EliteMasterEric

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions