From: Ingo Ruhnke Date: Thu, 31 Jul 2014 04:25:58 +0000 (+0200) Subject: Reenabled vsync and some other OpenGL attributes X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0f1c509aac5c95d530ecebf4a4c038f3b54a2747;p=supertux.git Reenabled vsync and some other OpenGL attributes --- diff --git a/src/video/gl/gl_renderer.cpp b/src/video/gl/gl_renderer.cpp index ca7a477d1..739ac7f17 100644 --- a/src/video/gl/gl_renderer.cpp +++ b/src/video/gl/gl_renderer.cpp @@ -60,21 +60,23 @@ GLRenderer::GLRenderer() : if(texture_manager != 0) texture_manager->save_textures(); -#ifdef SDL_GL_SWAP_CONTROL - if(config->try_vsync) { + if(g_config->try_vsync) { /* we want vsync for smooth scrolling */ - SDL_GL_SetSwapInterval(1); + if (SDL_GL_SetSwapInterval(-1) != 0) + { + log_info << "no support for late swap tearing vsync: " << SDL_GetError() << std::endl; + if (SDL_GL_SetSwapInterval(1)) + { + log_info << "no support for vsync: " << SDL_GetError() << std::endl; + } + } } -#endif -#ifdef OLD_SDL1 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - // FIXME: Hu? 16bit rendering? - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); -#endif + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); if(g_config->use_fullscreen) {