|
|
|
@ -113,7 +113,7 @@ void GraphicsWindowSDL2::init()
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SDL_GL_SetSwapInterval(_traits->vsync ? 1 : 0);
|
|
|
|
|
setSwapInterval(_traits->vsync);
|
|
|
|
|
|
|
|
|
|
SDL_GL_MakeCurrent(oldWin, oldCtx);
|
|
|
|
|
|
|
|
|
@ -194,11 +194,31 @@ void GraphicsWindowSDL2::setSyncToVBlank(bool on)
|
|
|
|
|
|
|
|
|
|
SDL_GL_MakeCurrent(mWindow, mContext);
|
|
|
|
|
|
|
|
|
|
SDL_GL_SetSwapInterval(on ? 1 : 0);
|
|
|
|
|
setSwapInterval(on);
|
|
|
|
|
|
|
|
|
|
SDL_GL_MakeCurrent(oldWin, oldCtx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GraphicsWindowSDL2::setSwapInterval(bool enable)
|
|
|
|
|
{
|
|
|
|
|
if (enable)
|
|
|
|
|
{
|
|
|
|
|
if (SDL_GL_SetSwapInterval(-1) == -1)
|
|
|
|
|
{
|
|
|
|
|
OSG_NOTICE << "Adaptive vsync unsupported" << std::endl;
|
|
|
|
|
if (SDL_GL_SetSwapInterval(1) == -1)
|
|
|
|
|
{
|
|
|
|
|
OSG_NOTICE << "Vertical synchronization unsupported, disabling" << std::endl;
|
|
|
|
|
SDL_GL_SetSwapInterval(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SDL_GL_SetSwapInterval(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GraphicsWindowSDL2::raiseWindow()
|
|
|
|
|
{
|
|
|
|
|
SDL_RaiseWindow(mWindow);
|
|
|
|
|