diff options
Diffstat (limited to 'src/render/graphics.cpp')
-rw-r--r-- | src/render/graphics.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index 5bb90e753..5cb45e8ca 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -71,6 +71,8 @@ #include "graphicsmanager.h" #include "logger.h" +#include "render/mglxinit.h" + #include "resources/imagehelper.h" #include "resources/openglimagehelper.h" @@ -99,10 +101,10 @@ Graphics::Graphics() : mWindow(nullptr), #ifdef USE_SDL2 mRenderer(nullptr), +#endif #ifdef USE_OPENGL mGLContext(nullptr), #endif -#endif mBpp(0), mAlpha(false), mFullscreen(false), @@ -252,11 +254,15 @@ bool Graphics::setOpenGLMode() mActualWidth, mActualHeight, mBpp, getOpenGLFlags()))) { + logger->log("Window/context creation failed"); mRect.w = 0; mRect.h = 0; return false; } +#if defined(USE_OPENGL) && defined(USE_X11) + Glx::initFunctions(); +#endif #ifdef USE_SDL2 int w1 = 0; int h1 = 0; @@ -264,10 +270,10 @@ bool Graphics::setOpenGLMode() mRect.w = static_cast<int32_t>(w1 / mScale); mRect.h = static_cast<int32_t>(h1 / mScale); - mGLContext = SDL_GL_CreateContext(mWindow); - + createGLContext(); #else // USE_SDL2 + createGLContext(); mRect.w = static_cast<uint16_t>(mWindow->w / mScale); mRect.h = static_cast<uint16_t>(mWindow->h / mScale); @@ -353,6 +359,14 @@ int Graphics::getSoftwareFlags() const return displayFlags; } +#ifdef USE_OPENGL +void Graphics::createGLContext() +{ +#ifdef USE_SDL2 + mGLContext = SDL_GL_CreateContext(mWindow); +#endif +} +#endif void Graphics::updateMemoryInfo() { |