diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 646db027d..668daca48 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -456,7 +456,9 @@ pause_on_lost_focus (Pause on lost window focus) bool false # to not waste CPU power for no benefit. fps_max (Maximum FPS) int 60 1 4294967295 -# Vertical screen synchronization. Your system may still force VSync on even if this is disabled. +# Vertical screen synchronization. +# Note: A restart is required after changing this! +# Your system may still force VSync and ignore this setting. vsync (VSync) bool false # Maximum FPS when the window is not focused. diff --git a/irr/src/CIrrDeviceSDL.cpp b/irr/src/CIrrDeviceSDL.cpp index 06b665633..239fcb5c0 100644 --- a/irr/src/CIrrDeviceSDL.cpp +++ b/irr/src/CIrrDeviceSDL.cpp @@ -779,6 +779,8 @@ void CIrrDeviceSDL::createDriver() } ContextManager = new video::CSDLManager(this); + ContextManager->initialize(CreationParams, {}); + switch (CreationParams.DriverType) { case video::EDT_OPENGL: VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager); diff --git a/irr/src/CSDLManager.cpp b/irr/src/CSDLManager.cpp index 839295721..f39af374f 100644 --- a/irr/src/CSDLManager.cpp +++ b/irr/src/CSDLManager.cpp @@ -7,6 +7,7 @@ #if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) #include "CIrrDeviceSDL.h" +#include "os.h" namespace video { @@ -18,6 +19,14 @@ CSDLManager::CSDLManager(CIrrDeviceSDL *device) : bool CSDLManager::initialize(const SIrrlichtCreationParameters ¶ms, const SExposedVideoData &data) { Data = data; + int interval = params.Vsync ? 1 : 0; +#ifdef _IRR_USE_SDL3_ + bool ok = SDL_GL_SetSwapInterval(interval); +#else + bool ok = SDL_GL_SetSwapInterval(interval) == 0; +#endif + if (!ok) + os::Printer::log("Setting GL swap interval failed"); return true; }