diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/graphics.cpp | 6 | ||||
-rw-r--r-- | src/render/graphics.h | 4 | ||||
-rw-r--r-- | src/render/mobileopengl2graphics.cpp | 4 | ||||
-rw-r--r-- | src/render/mobileopengl2graphics.h | 2 | ||||
-rw-r--r-- | src/render/modernopenglgraphics.cpp | 15 | ||||
-rw-r--r-- | src/render/modernopenglgraphics.h | 2 |
6 files changed, 20 insertions, 13 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index bc08ecfd3..59524d300 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -288,10 +288,10 @@ bool Graphics::setOpenGLMode() restrict2 mRect.w = CAST_S32(w1 / mScale); mRect.h = CAST_S32(h1 / mScale); - createGLContext(); + createGLContext(config.getBoolValue("openglContext")); #else // USE_SDL2 - createGLContext(); + createGLContext(config.getBoolValue("openglContext")); mRect.w = CAST_U16(mWindow->w / mScale); mRect.h = CAST_U16(mWindow->h / mScale); @@ -389,7 +389,7 @@ int Graphics::getSoftwareFlags() const restrict2 } #ifdef USE_OPENGL -void Graphics::createGLContext() restrict2 +void Graphics::createGLContext(const bool custom A_UNUSED) restrict2 { #ifdef USE_SDL2 mGLContext = SDL_GL_CreateContext(mWindow); diff --git a/src/render/graphics.h b/src/render/graphics.h index 016f2c4ab..997ed2196 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -404,9 +404,9 @@ class Graphics notfinal #ifdef USE_OPENGL #ifdef USE_SDL2 - virtual void createGLContext() restrict2; + virtual void createGLContext(const bool custom) restrict2; #else - virtual void createGLContext() restrict2 A_CONST; + virtual void createGLContext(const bool custom) restrict2 A_CONST; #endif #endif diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp index 163185bb6..576bc67ab 100644 --- a/src/render/mobileopengl2graphics.cpp +++ b/src/render/mobileopengl2graphics.cpp @@ -1227,9 +1227,9 @@ void MobileOpenGL2Graphics::clearScreen() const restrict2 GL_STENCIL_BUFFER_BIT); } -void MobileOpenGL2Graphics::createGLContext() restrict2 +void MobileOpenGL2Graphics::createGLContext(const bool custom) restrict2 { - Graphics::createGLContext(); + Graphics::createGLContext(custom); /* if (mGLContext) SDL::makeCurrentContext(mGLContext); diff --git a/src/render/mobileopengl2graphics.h b/src/render/mobileopengl2graphics.h index 9b171becb..2efa367c4 100644 --- a/src/render/mobileopengl2graphics.h +++ b/src/render/mobileopengl2graphics.h @@ -77,7 +77,7 @@ class MobileOpenGL2Graphics final : public Graphics uint32_t *restrict const arr) restrict2 override final A_NONNULL(3); - void createGLContext() restrict2 override final; + void createGLContext(const bool custom) restrict2 override final; #include "render/graphicsdef.hpp" RENDER_GRAPHICSDEF_HPP diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index 458a9a9f7..1629dbea5 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -1221,12 +1221,19 @@ void ModernOpenGLGraphics::clearScreen() const restrict2 GL_STENCIL_BUFFER_BIT); } -void ModernOpenGLGraphics::createGLContext() restrict2 +void ModernOpenGLGraphics::createGLContext(const bool custom) restrict2 { - if (mGLContext) - SDL::makeCurrentContext(mGLContext); + if (custom) + { + if (mGLContext) + SDL::makeCurrentContext(mGLContext); + else + mGLContext = SDL::createGLContext(mWindow, 3, 3, 0x01); + } else - mGLContext = SDL::createGLContext(mWindow, 3, 3, 0x01); + { + Graphics::createGLContext(false); + } } void ModernOpenGLGraphics::finalize(ImageCollection *restrict const col) diff --git a/src/render/modernopenglgraphics.h b/src/render/modernopenglgraphics.h index f7eecd0c4..53d6966c2 100644 --- a/src/render/modernopenglgraphics.h +++ b/src/render/modernopenglgraphics.h @@ -77,7 +77,7 @@ class ModernOpenGLGraphics final : public Graphics uint32_t *restrict const arr) restrict2 override final A_NONNULL(3); - void createGLContext() restrict2 override final; + void createGLContext(const bool custom) restrict2 override final; #include "render/graphicsdef.hpp" RENDER_GRAPHICSDEF_HPP |