OPENGL: Simplify orthogonal projection setup.
This commit is contained in:
parent
67e2790beb
commit
c5ce812711
2 changed files with 11 additions and 18 deletions
|
@ -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));
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue