summaryrefslogtreecommitdiff
path: root/src/graphicsmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r--src/graphicsmanager.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 90f723f82..33cbd0224 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -272,6 +272,7 @@ void GraphicsManager::createRenderers()
mUseTextureSampler = false;
break;
case RENDER_NORMAL_OPENGL:
+ case RENDER_MODERN_OPENGL:
#ifndef USE_SDL2
case RENDER_SDL2_DEFAULT:
#endif
@@ -328,6 +329,7 @@ void GraphicsManager::createRenderers()
case RENDER_SOFTWARE:
case RENDER_SAFE_OPENGL:
case RENDER_GLES_OPENGL:
+ case RENDER_MODERN_OPENGL:
case RENDER_NORMAL_OPENGL:
case RENDER_NULL:
case RENDER_LAST:
@@ -450,18 +452,30 @@ void GraphicsManager::initGraphics()
detectPixelSize();
setVideoMode();
#ifdef USE_OPENGL
+ const RenderType oldOpenGLMode = openGLMode;
+ if (openGLMode == RENDER_MODERN_OPENGL)
+ {
+ if (!checkGLVersion(3, 0))
+ {
+ logger->log("Fallback to normal OpenGL mode");
+ openGLMode = RENDER_NORMAL_OPENGL;
+ }
+ }
if (openGLMode == RENDER_NORMAL_OPENGL || openGLMode == RENDER_GLES_OPENGL)
{
if (!checkGLVersion(2, 0))
{
logger->log("Fallback to safe OpenGL mode");
openGLMode = RENDER_SAFE_OPENGL;
- deleteRenderers();
- createRenderers();
- detectPixelSize();
- setVideoMode();
}
}
+ if (openGLMode != oldOpenGLMode)
+ {
+ deleteRenderers();
+ createRenderers();
+ detectPixelSize();
+ setVideoMode();
+ }
#endif
}
@@ -688,9 +702,6 @@ void GraphicsManager::updateTextureFormat() const
logger->log1("using 4 texture format");
}
}
-#endif
-
-#ifdef USE_OPENGL
void GraphicsManager::logString(const char *const format, const int num)
{