mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-20 16:35:25 +01:00
Implement Vsync for SDL device (#16683)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user