From 33958ca5b2fbd5ed1e721d5f57519fc957e3ad07 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 24 Nov 2016 07:37:15 +0100 Subject: [PATCH] Add vid_vsync support to Linux target --- src/posix/sdl/sdlglvideo.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index d8c00f2363..173a84d801 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -442,6 +442,16 @@ void SDLGLFB::SetVSync( bool vsync ) #if defined (__APPLE__) const GLint value = vsync ? 1 : 0; CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval, &value ); +#else + if (vsync) + { + if (SDL_GL_SetSwapInterval(-1) == -1) + SDL_GL_SetSwapInterval(1); + } + else + { + SDL_GL_SetSwapInterval(0); + } #endif }