]> git.jsancho.org Git - lugaru.git/commitdiff
Force a double-buffered GL context.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 17 Nov 2009 09:03:57 +0000 (04:03 -0500)
committerRyan C. Gordon <icculus@icculus.org>
Tue, 17 Nov 2009 09:03:57 +0000 (04:03 -0500)
Source/OpenGL_Windows.cpp

index 244e13505d85949f081aa5db625b5c6f1e471194..64fce3903fed9ceee1857e4b16b62a8fb405bf13 100644 (file)
@@ -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();