Integrate GLEW to the Visual Studio project

I also removed USE_GL_RENDERING (OpenGL rendering is now used
unconditionally), moved initialization of gl::context out of the
constructor, and added some light logging about OpenGL (so that, in the
future with hardware-specific issues, we have a way to know which hardware
is affected).

This commit breaks build with anything except Visual Studio due to
requiring OpenGL and GLEW but not linking to them.
This commit is contained in:
Jyrki Vesterinen 2018-03-27 21:33:37 +03:00
parent ae4ef058ed
commit 695c8eebe8
13 changed files with 65 additions and 120 deletions

View file

@ -119,7 +119,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src;..\..\..\external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;DEBUG_LUA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;GLEW_STATIC;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;DEBUG_LUA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
@ -136,7 +136,7 @@
</ResourceCompile>
<Link>
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;SDL2_ttf.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;$(IntDir)liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;opengl32.lib;glew32s.lib;SDL2_ttf.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;$(IntDir)liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\external\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>MSVCR90;MSVCRT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
@ -156,7 +156,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\..\src;..\..\..\external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;GLEW_STATIC;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -175,7 +175,7 @@
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;$(IntDir)liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;opengl32.lib;glew32s.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;$(IntDir)liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\external\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@ -199,7 +199,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src;..\..\..\external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;DEBUG_LUA;MSVC_DO_UNIT_TESTS;BOOST_TEST_DYN_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;GLEW_STATIC;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;DEBUG_LUA;MSVC_DO_UNIT_TESTS;BOOST_TEST_DYN_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
@ -215,7 +215,7 @@
<PreprocessorDefinitions>_MSC_VER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;SDL2_ttf.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;Debug\liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;opengl32.lib;glew32s.lib;SDL2_ttf.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;Debug\liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)test.exe</OutputFile>
<AdditionalLibraryDirectories>..\..\..\external\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
@ -235,7 +235,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\..\src;..\..\..\external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;MSVC_DO_UNIT_TESTS;BOOST_TEST_DYN_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;GLEW_STATIC;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;MSVC_DO_UNIT_TESTS;BOOST_TEST_DYN_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -254,7 +254,7 @@
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;SDL2_ttf.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;Release\liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;opengl32.lib;glew32s.lib;SDL2_ttf.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;Release\liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)test.exe</OutputFile>
<AdditionalLibraryDirectories>..\..\..\external\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
@ -281,7 +281,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\..\src;..\..\..\external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;GLEW_STATIC;_WINSOCK_DEPRECATED_NO_WARNINGS;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;HAVE_PYTHON;USE_GZIP;NO_HAVE_FRIBIDI;HAVE_LIBPNG;NOMINMAX;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -300,7 +300,7 @@
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;SDL2_ttf.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;$(IntDir)liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;SDL2_image.lib;opengl32.lib;glew32s.lib;SDL2_ttf.lib;SDL2_mixer.lib;libcrypto.lib;cairo.lib;winmm.lib;ws2_32.lib;pango-1.0.lib;pangocairo-1.0.lib;gobject-2.0.lib;glib-2.0.lib;libpng.lib;$(IntDir)liblua.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\external\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>

View file

@ -35,11 +35,7 @@ editor_display::editor_display(editor_controller& controller, const config& them
, brush_locations_()
, controller_(controller)
{
#ifdef USE_GL_RENDERING
gl::clear_screen();
#else
video().clear_screen();
#endif
}
void editor_display::add_brush_loc(const map_location& hex)

View file

@ -623,11 +623,7 @@ void run_event_loop()
//
CVideo& video = CVideo::get_singleton();
#ifdef USE_GL_RENDERING
gl::clear_screen();
#else
video.clear_screen();
#endif
raise_draw_event();

View file

@ -71,12 +71,7 @@ game_display::game_display(game_board& board, std::weak_ptr<wb::manager> wb,
, mode_(RUNNING)
, needs_rebuild_(false)
{
#ifdef USE_GL_RENDERING
gl::clear_screen();
#else
video().clear_screen();
#endif
}
game_display::~game_display()

View file

@ -11,31 +11,60 @@
See the COPYING file for more details.
*/
#ifdef USE_GL_RENDERING
#include "ogl/context.hpp"
#include <SDL_video.h>
#include "log.hpp"
#include <GL/glew.h>
#include <SDL.h>
#include <iostream>
#include <stdexcept>
static lg::log_domain log_opengl("opengl");
#define LOG_GL LOG_STREAM(info, log_opengl)
#define ERR_GL LOG_STREAM(err, log_opengl)
namespace gl
{
context::context(sdl::window* window)
: gl_context_(SDL_GL_CreateContext(*window))
{
// Set flags.
set_context_flags();
// Initialize GLEW.
// TODO: should this be moved somewhere else?
glewExperimental = GL_TRUE;
glewInit();
}
context::~context()
{
SDL_GL_DeleteContext(gl_context_);
}
void context::init(sdl::window* window)
{
// Set flags.
set_context_flags();
// Attempt to create the context.
gl_context_ = SDL_GL_CreateContext(*window);
if(gl_context_ == nullptr) {
ERR_GL << "Error creating OpenGL context: too old hardware/drivers?\n";
ERR_GL << SDL_GetError() << std::endl;
throw std::runtime_error("error creating OpenGL context");
}
// Initialize GLEW.
glewExperimental = GL_TRUE;
GLenum result = glewInit();
if(result != GLEW_OK) {
ERR_GL << "Error initializing GLEW\n";
throw std::runtime_error("error initializing GLEW");
}
// Print some information.
GLint profile;
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
bool core_profile = profile & GL_CONTEXT_CORE_PROFILE_BIT;
LOG_GL << "Using OpenGL " << (core_profile ? "core profile " : "") <<
"version " << glGetString(GL_VERSION) << std::endl;
LOG_GL << "GPU: " <<
glGetString(GL_VENDOR) << " " << glGetString(GL_RENDERER) << std::endl;
}
void context::set_context_flags()
{
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
@ -53,5 +82,3 @@ void context::set_context_flags()
}
}
#endif // USE_GL_RENDERING

View file

@ -13,39 +13,28 @@
#pragma once
#ifdef USE_GL_RENDERING
#include "sdl/window.hpp"
#include <GL/glew.h>
#include <GL/gl.h>
namespace gl
{
/** Encapsulates the management of an OpenGL context for the current window. */
class context
{
public:
context() = default;
context(const context&) = delete;
context& operator=(const context&) = delete;
/**
* Constructor
*
* @param window The SDL window to attach a context to.
*/
context(sdl::window* window);
~context();
void init(sdl::window* window);
private:
/** Sets any relevant flags for the GL context. */
void set_context_flags();
/** The window's OpenGL context. */
SDL_GLContext gl_context_;
SDL_GLContext gl_context_ = nullptr;
};
} // namespace gl
#endif // USE_GL_RENDERING

View file

@ -11,11 +11,9 @@
See the COPYING file for more details.
*/
#ifdef USE_GL_RENDERING
#include "ogl/utils.hpp"
#include <GL/gl.h>
#include <GL/glew.h>
namespace gl
{
@ -27,5 +25,3 @@ void clear_screen()
}
} // namespace gl
#endif // USE_GL_RENDERING

View file

@ -13,13 +13,9 @@
#pragma once
#ifdef USE_GL_RENDERING
namespace gl
{
/** Fills the screen with fully-transparent black. */
void clear_screen();
} // namespace gl
#endif // USE_GL_RENDERING

View file

@ -269,11 +269,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(const config& level)
const bool is_victory = get_end_level_data_const().is_victory;
if(gamestate().gamedata_.phase() <= game_data::PRESTART) {
#ifdef USE_GL_RENDERING
gl::clear_screen();
#else
gui_->video().clear_screen();
#endif
}
ai_testing::log_game_end();

View file

@ -27,45 +27,13 @@ window::window(const std::string& title,
const int y,
const int w,
const int h,
const uint32_t window_flags,
const uint32_t render_flags)
const uint32_t window_flags)
: window_(SDL_CreateWindow(title.c_str(), x, y, w, h, window_flags))
, info_()
{
if(!window_) {
throw exception("Failed to create a SDL_Window object.", true);
}
#ifndef USE_GL_RENDERING
if(!SDL_CreateRenderer(window_, -1, render_flags)) {
throw exception("Failed to create a SDL_Renderer object.", true);
}
if(SDL_GetRendererInfo(*this, &info_) != 0) {
throw exception("Failed to retrieve the information of the renderer.",
true);
}
if(info_.num_texture_formats == 0) {
throw exception("The renderer has no texture information available.\n",
false);
}
if(!(info_.flags & SDL_RENDERER_TARGETTEXTURE)) {
throw exception("Render-to-texture not supported or enabled!", false);
}
// Set default blend mode to blend.
SDL_SetRenderDrawBlendMode(*this, SDL_BLENDMODE_BLEND);
// In fullscreen mode, do not minimize on focus loss.
// Minimizing was reported as bug #1606 with blocker priority.
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
fill(0,0,0);
render();
#endif
}
window::~window()
@ -132,11 +100,7 @@ void window::fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
void window::render()
{
#ifdef USE_GL_RENDERING
SDL_GL_SwapWindow(*this);
#else
SDL_RenderPresent(*this);
#endif
}
void window::set_title(const std::string& title)

View file

@ -61,15 +61,13 @@ public:
* @param w Used as w for @ref SDL_CreateWindow.
* @param h Used as x for @ref SDL_CreateWindow.
* @param window_flags Used as flags for @ref SDL_CreateWindow.
* @param render_flags Used as flags for @ref SDL_CreateRenderer.
*/
window(const std::string& title,
const int x,
const int y,
const int w,
const int h,
const uint32_t window_flags,
const uint32_t render_flags);
const uint32_t window_flags);
~window();

View file

@ -43,9 +43,7 @@ bool interactive = true;
CVideo::CVideo(FAKE_TYPES type)
: window()
#ifdef USE_GL_RENDERING
, gl_context()
#endif
, gl_context_()
, fake_screen_(false)
, fake_size_(0u, 0u)
, updated_locked_(0)
@ -133,12 +131,10 @@ void CVideo::init_window()
// Add any more default flags here
window_flags |= SDL_WINDOW_RESIZABLE;
window_flags |= SDL_WINDOW_OPENGL;
#ifdef __APPLE__
window_flags |= SDL_WINDOW_ALLOW_HIGHDPI;
#endif
#ifdef USE_GL_RENDERING
video_flags |= SDL_WINDOW_OPENGL;
#endif
if(preferences::fullscreen()) {
window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
@ -147,19 +143,17 @@ void CVideo::init_window()
}
// Initialize window
window.reset(new sdl::window("", x, y, w, h, window_flags, SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE));
window.reset(new sdl::window("", x, y, w, h, window_flags));
std::cerr << "Setting mode to " << w << "x" << h << std::endl;
window->set_minimum_size(preferences::min_window_width, preferences::min_window_height);
#ifdef USE_GL_RENDERING
// Initialize an OpenGL context for the window.
gl_context.reset(new gl::context(window.get()));
gl_context_.init(window.get());
gl::clear_screen();
render_screen();
#endif
event_handler_.join_global();
}

View file

@ -217,10 +217,8 @@ private:
/** The SDL window object. */
std::unique_ptr<sdl::window> window;
#ifdef USE_GL_RENDERING
/** The OpenGL context attached to the SDL window. */
std::unique_ptr<gl::context> gl_context;
#endif
gl::context gl_context_;
/** Initializes the SDL video subsystem. */
void initSDL();