I have an
SDL_Renderer which I set to use or not use vSync depending on the user). In my options menu I have an option for enabling/disabling vSync. Can I edit my renderer to update the vSync preferences so that I don't have to destroy and recreate it? Doing so would invalidate a lot of renderer pointers in my game, so I would like to find an alternative solution.
I have an
Ok, I asked on the SDL Forums too:
- There is no way to edit vSync settings after renderer creation without using OpenGL.
- Destroying the renderer and re-creating it, is not an option because it will destroy every texture created with it.
So vSync shouldn't be an user-editable setting (at least for now).
EDIT: The following only works when executed before calling
SDL_CreateRenderer. Seems like SDL has made a simple and trivial task quite hard.
SDL wiki suggests that calling
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1" or "0"); should do the trick.
You might also want to try SDL_SetHintWithPriority, which will override any possible environment variables that have been set that could prevent that value passed in to
SDL_SetHint to have an effect.