aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl
diff options
context:
space:
mode:
authorJohannes Schickel2015-12-19 18:06:10 +0100
committerJohannes Schickel2016-03-16 20:29:25 +0100
commitc5ce812711c68ea546926f243b9f6f0ece8ca736 (patch)
treebb735f96163329eca51b31db6fc6cd35d4436b52 /backends/graphics/opengl
parent67e2790beba8e309dccfe9c64ea3f636fdeed5b9 (diff)
downloadscummvm-rg350-c5ce812711c68ea546926f243b9f6f0ece8ca736.tar.gz
scummvm-rg350-c5ce812711c68ea546926f243b9f6f0ece8ca736.tar.bz2
scummvm-rg350-c5ce812711c68ea546926f243b9f6f0ece8ca736.zip
OPENGL: Simplify orthogonal projection setup.
Diffstat (limited to 'backends/graphics/opengl')
-rw-r--r--backends/graphics/opengl/opengl-func.h7
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp22
2 files changed, 11 insertions, 18 deletions
diff --git a/backends/graphics/opengl/opengl-func.h b/backends/graphics/opengl/opengl-func.h
index 0ff39c845a..d13dece1ea 100644
--- a/backends/graphics/opengl/opengl-func.h
+++ b/backends/graphics/opengl/opengl-func.h
@@ -70,12 +70,7 @@ GL_FUNC_DEF(void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat
GL_FUNC_DEF(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height));
GL_FUNC_DEF(void, glMatrixMode, (GLenum mode));
GL_FUNC_DEF(void, glLoadIdentity, ());
-#if !USE_FORCED_GL
-GL_FUNC_DEF(void, glOrthof, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar));
-#endif
-#if !USE_FORCED_GLES
-GL_FUNC_DEF(void, glOrtho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val));
-#endif
+GL_FUNC_DEF(void, glLoadMatrixf, (const GLfloat *m));
GL_FUNC_DEF(void, glShadeModel, (GLenum mode));
GL_FUNC_DEF(void, glHint, (GLenum target, GLenum mode));
GL_FUNC_DEF(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha));
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 78c6b2aff1..108366744d 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -757,19 +757,17 @@ void OpenGLGraphicsManager::setActualScreenSize(uint width, uint height) {
// Setup coordinates system.
GL_CALL(glViewport(0, 0, _outputScreenWidth, _outputScreenHeight));
+ // Orthogonal projection matrix in column major order.
+ const GLfloat orthoProjection[4*4] = {
+ 2.0f / _outputScreenWidth, 0.0f , 0.0f, 0.0f,
+ 0.0f , -2.0f / _outputScreenHeight, 0.0f, 0.0f,
+ 0.0f , 0.0f , -1.0f, 0.0f,
+ -1.0f , 1.0f , 0.0f, 1.0f
+ };
+
GL_CALL(glMatrixMode(GL_PROJECTION));
- GL_CALL(glLoadIdentity());
-#if USE_FORCED_GLES
- GL_CALL(glOrthof(0, _outputScreenWidth, _outputScreenHeight, 0, -1, 1));
-#elif USE_FORCED_GL
- GL_CALL(glOrtho(0, _outputScreenWidth, _outputScreenHeight, 0, -1, 1));
-#else
- if (isGLESContext()) {
- GL_CALL(glOrthof(0, _outputScreenWidth, _outputScreenHeight, 0, -1, 1));
- } else {
- GL_CALL(glOrtho(0, _outputScreenWidth, _outputScreenHeight, 0, -1, 1));
- }
-#endif
+ GL_CALL(glLoadMatrixf(orthoProjection));
+
GL_CALL(glMatrixMode(GL_MODELVIEW));
GL_CALL(glLoadIdentity());