aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/openglsdl
diff options
context:
space:
mode:
authorJohannes Schickel2015-12-18 21:14:48 +0100
committerJohannes Schickel2016-03-16 20:29:25 +0100
commitaf727afe0ceb66eaf51985ceceb2ac842b3358ee (patch)
tree90a7194bb25c83c5a50e25358e340d2a31595d4c /backends/graphics/openglsdl
parentda062ad1ea2d933ae7c4b56f84f34c5fb2186196 (diff)
downloadscummvm-rg350-af727afe0ceb66eaf51985ceceb2ac842b3358ee.tar.gz
scummvm-rg350-af727afe0ceb66eaf51985ceceb2ac842b3358ee.tar.bz2
scummvm-rg350-af727afe0ceb66eaf51985ceceb2ac842b3358ee.zip
OPENGL: Simplify context type setting.
Diffstat (limited to 'backends/graphics/openglsdl')
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp21
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.h1
2 files changed, 13 insertions, 9 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index e7b6da206e..75d3fa1ebb 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -47,15 +47,17 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
// Setup proper SDL OpenGL context creation.
#if SDL_VERSION_ATLEAST(2, 0, 0)
+ OpenGL::ContextType glContextType;
+
#if USE_FORCED_GL
- _glContextType = OpenGL::kContextGL;
+ glContextType = OpenGL::kContextGL;
_glContextProfileMask = SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
// Context version 1.4 is choosen arbitrarily based on what most shader
// extensions were written against.
_glContextMajor = 1;
_glContextMinor = 4;
#elif USE_FORCED_GLES
- _glContextType = OpenGL::kContextGLES;
+ glContextType = OpenGL::kContextGLES;
_glContextProfileMask = SDL_GL_CONTEXT_PROFILE_ES;
_glContextMajor = 1;
_glContextMinor = 1;
@@ -103,7 +105,7 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
}
if (_glContextProfileMask == SDL_GL_CONTEXT_PROFILE_ES) {
- _glContextType = OpenGL::kContextGLES;
+ glContextType = OpenGL::kContextGLES;
// We do not support GLES2 contexts right now. Force a GLES1 context.
if (_glContextMajor >= 2) {
@@ -111,7 +113,7 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
_glContextMinor = 1;
}
} else if (_glContextProfileMask == SDL_GL_CONTEXT_PROFILE_CORE) {
- _glContextType = OpenGL::kContextGL;
+ glContextType = OpenGL::kContextGL;
// Core profile does not allow legacy functionality, which we use.
// Thus we always request a compatibility profile.
@@ -121,9 +123,12 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
_glContextMajor = 1;
_glContextMinor = 4;
} else {
- _glContextType = OpenGL::kContextGL;
+ glContextType = OpenGL::kContextGL;
}
#endif
+ setContextType(glContextType);
+#else
+ setContextType(OpenGL::kContextGL);
#endif
// Retrieve a list of working fullscreen modes
@@ -293,7 +298,7 @@ Common::List<Graphics::PixelFormat> OpenGLSdlGraphicsManager::getSupportedFormat
#if !USE_FORCED_GLES
#if !USE_FORCED_GL
- if (isInitialized() && !isGLESContext()) {
+ if (!isGLESContext()) {
#endif
#ifdef SCUMM_LITTLE_ENDIAN
// RGBA8888
@@ -491,7 +496,7 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
return false;
}
- notifyContextCreate(rgba8888, rgba8888, _glContextType);
+ notifyContextCreate(rgba8888, rgba8888);
int actualWidth, actualHeight;
getWindowDimensions(&actualWidth, &actualHeight);
setActualScreenSize(actualWidth, actualHeight);
@@ -539,7 +544,7 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
_lastVideoModeLoad = SDL_GetTicks();
if (_hwScreen) {
- notifyContextCreate(rgba8888, rgba8888, OpenGL::kContextGL);
+ notifyContextCreate(rgba8888, rgba8888);
setActualScreenSize(_hwScreen->w, _hwScreen->h);
_eventSource->resetKeyboadEmulation(_hwScreen->w - 1, _hwScreen->h - 1);
}
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h
index 792116358b..51edcb4363 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.h
+++ b/backends/graphics/openglsdl/openglsdl-graphics.h
@@ -74,7 +74,6 @@ private:
#if SDL_VERSION_ATLEAST(2, 0, 0)
int _glContextProfileMask, _glContextMajor, _glContextMinor;
- OpenGL::ContextType _glContextType;
SDL_GLContext _glContext;
#else
uint32 _lastVideoModeLoad;