From: Ryan C. Gordon Date: Tue, 17 Nov 2009 09:03:57 +0000 (-0500) Subject: Force a double-buffered GL context. X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=3c8f67c3c66a86fc9e45469ce2fed4222d486c9f;p=lugaru.git Force a double-buffered GL context. --- diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 244e135..64fce39 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -928,6 +928,8 @@ Boolean SetUp (Game & game) SDL_ShowCursor(0); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + if (SDL_SetVideoMode(kContextWidth, kContextHeight, 0, sdlflags) == NULL) { fprintf(stderr, "SDL_SetVideoMode() failed: %s\n", SDL_GetError()); @@ -947,6 +949,14 @@ Boolean SetUp (Game & game) } } + int dblbuf = 0; + if ((SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &dblbuf) == -1) || (!dblbuf)) + { + fprintf(stderr, "Failed to get double buffered GL context!\n"); + SDL_Quit(); + return false; + } + if (!lookup_all_glsyms()) { SDL_Quit();