From 29013ff57d71aec02a36eb4a61bd971ebca33a5a Mon Sep 17 00:00:00 2001 From: dhewg Date: Sat, 31 Dec 2011 03:40:46 +0100 Subject: [PATCH] Use SDL for r_swapInterval Enables vsync support for more platforms than just Windows. --- neo/renderer/RenderSystem_init.cpp | 12 ------------ neo/sys/glimp.cpp | 3 +++ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index abc10a02..22e8d589 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -1836,18 +1836,6 @@ static void GfxInfo_f( const idCmdArgs &args ) { common->Printf( "glFinish not forced\n" ); } -#ifdef _WIN32 -// WGL_EXT_swap_interval -typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); -extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT; - - if ( r_swapInterval.GetInteger() && wglSwapIntervalEXT ) { - common->Printf( "Forcing swapInterval %i\n", r_swapInterval.GetInteger() ); - } else { - common->Printf( "swapInterval not forced\n" ); - } -#endif - bool tss = glConfig.twoSidedStencilAvailable || glConfig.atiTwoSidedStencilAvailable; if ( !r_useTwoSidedStencil.GetBool() && tss ) { diff --git a/neo/sys/glimp.cpp b/neo/sys/glimp.cpp index 741e6493..d4ccc553 100644 --- a/neo/sys/glimp.cpp +++ b/neo/sys/glimp.cpp @@ -129,6 +129,9 @@ bool GLimp_Init(glimpParms_t parms) { SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, parms.multiSamples ? 1 : 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, parms.multiSamples); + if (SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, r_swapInterval.GetInteger()) < 0) + common->Warning("SDL_GL_SWAP_CONTROL not supported"); + surf = SDL_SetVideoMode(parms.width, parms.height, colorbits, flags); if (!surf) { common->DPrintf("Couldn't set GL mode %d/%d/%d: %s",