aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/openglsdl/openglsdl-graphics.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2015-12-12 22:08:33 +0100
committerJohannes Schickel2016-03-16 20:29:25 +0100
commitd6d3e17d53754acedce0b1706e73f929d29b5eb8 (patch)
treeb6e3961fff722a9a07fc17b35eea4ebaa124c94b /backends/graphics/openglsdl/openglsdl-graphics.cpp
parent9816e4f35035b6fa461dc1bc255ced533f5feaf9 (diff)
downloadscummvm-rg350-d6d3e17d53754acedce0b1706e73f929d29b5eb8.tar.gz
scummvm-rg350-d6d3e17d53754acedce0b1706e73f929d29b5eb8.tar.bz2
scummvm-rg350-d6d3e17d53754acedce0b1706e73f929d29b5eb8.zip
OPENGL: Allow runtime specification of OpenGL mode.
Formerly, we required that the OpenGL mode was fixed at compile time. Now we allow the code to work with whatever it is given at runtime. It is still possible to force a context type on compile time.
Diffstat (limited to 'backends/graphics/openglsdl/openglsdl-graphics.cpp')
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 1992925998..a945138578 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -210,16 +210,22 @@ Common::List<Graphics::PixelFormat> OpenGLSdlGraphicsManager::getSupportedFormat
// RGBA4444
formats.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0));
-#ifndef USE_GLES
+#if !USE_FORCED_GLES
+#if !USE_FORCED_GL
+ if (isInitialized() && !isGLESContext()) {
+#endif
#ifdef SCUMM_LITTLE_ENDIAN
- // RGBA8888
- formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+ // RGBA8888
+ formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
#else
- // ABGR8888
- formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
+ // ABGR8888
+ formats.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
+#endif
+ // RGB555, this is used by SCUMM HE 16 bit games.
+ formats.push_back(Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
+#if !USE_FORCED_GL
+ }
#endif
- // RGB555, this is used by SCUMM HE 16 bit games.
- formats.push_back(Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
#endif
formats.push_back(Graphics::PixelFormat::createFormatCLUT8());
@@ -391,7 +397,7 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
}
}
-#ifdef USE_GLES
+#if USE_FORCED_GLES
// SDL2 will create a GLES2 context by default, so this is needed for GLES1-profile
// functions to work.
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
@@ -403,7 +409,13 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
return false;
}
- notifyContextCreate(rgba8888, rgba8888);
+ notifyContextCreate(rgba8888, rgba8888,
+#if USE_FORCED_GLES
+ OpenGL::kContextGLES
+#else
+ OpenGL::kContextGL
+#endif
+ );
int actualWidth, actualHeight;
getWindowDimensions(&actualWidth, &actualHeight);
setActualScreenSize(actualWidth, actualHeight);
@@ -451,7 +463,7 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
_lastVideoModeLoad = SDL_GetTicks();
if (_hwScreen) {
- notifyContextCreate(rgba8888, rgba8888);
+ notifyContextCreate(rgba8888, rgba8888, OpenGL::kContextGL);
setActualScreenSize(_hwScreen->w, _hwScreen->h);
_eventSource->resetKeyboadEmulation(_hwScreen->w - 1, _hwScreen->h - 1);
}