From e750e823323f664a78e4e84cb4166d12bf1ba7df Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 10 Aug 2011 14:08:00 +0000 Subject: [PATCH] gl: initialise Glew in the video setup instead of the SDL app, so we don't have to duplicate this code to other places. Fixes the GTK app on the way. --- src/sdlapp.cpp | 9 --------- src/video.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/sdlapp.cpp b/src/sdlapp.cpp index 5f4a40de..227d3d0a 100644 --- a/src/sdlapp.cpp +++ b/src/sdlapp.cpp @@ -59,15 +59,6 @@ SdlApp::SdlApp(char const *title, vec2i res, float fps) : SDL_Quit(); exit(EXIT_FAILURE); } -#if defined USE_GLEW - GLenum glerr = glewInit(); - if (glerr != GLEW_OK) - { - Log::Error("cannot initialise GLEW: %s\n", glewGetErrorString(glerr)); - SDL_Quit(); - exit(EXIT_FAILURE); - } -#endif SDL_WM_SetCaption(title, NULL); SDL_ShowCursor(0); diff --git a/src/video.cpp b/src/video.cpp index c8b3bcf8..eb63257c 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -51,6 +51,16 @@ vec2i VideoData::saved_viewport = 0; void Video::Setup(vec2i size) { +#if defined USE_GLEW + /* Initialise GLEW if necessary */ + GLenum glerr = glewInit(); + if (glerr != GLEW_OK) + { + Log::Error("cannot initialise GLEW: %s\n", glewGetErrorString(glerr)); + exit(EXIT_FAILURE); + } +#endif + /* Initialise OpenGL */ glViewport(0, 0, size.x, size.y);