aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/openglsdl
diff options
context:
space:
mode:
authorJohannes Schickel2015-12-20 05:42:54 +0100
committerJohannes Schickel2016-03-16 20:29:25 +0100
commitfe88375ff376cbb0d940c96ac6ec1667be4acab0 (patch)
treea5aa6530eb42dd4cdd3148025c37d95377686059 /backends/graphics/openglsdl
parente9310186735f34c6b085a58629b140a031d1da4e (diff)
downloadscummvm-rg350-fe88375ff376cbb0d940c96ac6ec1667be4acab0.tar.gz
scummvm-rg350-fe88375ff376cbb0d940c96ac6ec1667be4acab0.tar.bz2
scummvm-rg350-fe88375ff376cbb0d940c96ac6ec1667be4acab0.zip
OPENGL: Support GLES2 contexts.
Diffstat (limited to 'backends/graphics/openglsdl')
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 94f5f7aba2..f2af7ccadd 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -57,6 +57,9 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
#define DEFAULT_GLES_MAJOR 1
#define DEFAULT_GLES_MINOR 1
+#define DEFAULT_GLES2_MAJOR 2
+#define DEFAULT_GLES2_MINOR 0
+
#if USE_FORCED_GL
glContextType = OpenGL::kContextGL;
_glContextProfileMask = SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
@@ -67,6 +70,11 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
_glContextProfileMask = SDL_GL_CONTEXT_PROFILE_ES;
_glContextMajor = DEFAULT_GLES_MAJOR;
_glContextMinor = DEFAULT_GLES_MINOR;
+#elif USE_FORCED_GLES2
+ glContextType = OpenGL::kContextGLES2;
+ _glContextProfileMask = SDL_GL_CONTEXT_PROFILE_ES;
+ _glContextMajor = DEFAULT_GLES2_MAJOR;
+ _glContextMinor = DEFAULT_GLES2_MINOR;
#else
bool noDefaults = false;
@@ -102,12 +110,10 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
}
if (_glContextProfileMask == SDL_GL_CONTEXT_PROFILE_ES) {
- glContextType = OpenGL::kContextGLES;
-
- // We do not support GLES2 contexts right now. Force a GLES1 context.
if (_glContextMajor >= 2) {
- _glContextMajor = DEFAULT_GLES_MAJOR;
- _glContextMinor = DEFAULT_GLES_MINOR;
+ glContextType = OpenGL::kContextGLES2;
+ } else {
+ glContextType = OpenGL::kContextGLES;
}
} else if (_glContextProfileMask == SDL_GL_CONTEXT_PROFILE_CORE) {
glContextType = OpenGL::kContextGL;
@@ -124,6 +130,8 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
#undef DEFAULT_GL_MINOR
#undef DEFAULT_GLES_MAJOR
#undef DEFAULT_GLES_MINOR
+#undef DEFAULT_GLES2_MAJOR
+#undef DEFAULT_GLES2_MINOR
#endif
setContextType(glContextType);
@@ -296,7 +304,7 @@ Common::List<Graphics::PixelFormat> OpenGLSdlGraphicsManager::getSupportedFormat
// RGBA4444
formats.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0));
-#if !USE_FORCED_GLES
+#if !USE_FORCED_GLES && !USE_FORCED_GLES2
#if !USE_FORCED_GL
if (!isGLESContext()) {
#endif