From 3c8f67c3c66a86fc9e45469ce2fed4222d486c9f Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 17 Nov 2009 04:03:57 -0500 Subject: [PATCH] Force a double-buffered GL context. --- Source/OpenGL_Windows.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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(); -- 2.39.5