Fixed bug 3347 - OpenGL ES renderer doesn't flip projection matrix for target textures

Simon Hug

When updating the viewport in GLES_UpdateViewport, the OpenGL ES renderer doesn't flip the projection matrix for target textures. The lines, rectangles and textures (if drawn with glDrawArrays) are upside down when drawing to target textures.
This commit is contained in:
Sam Lantinga 2016-10-01 11:40:57 -07:00
parent 061cc5e75f
commit 89c868f4f8
1 changed files with 15 additions and 6 deletions

View File

@ -676,13 +676,22 @@ GLES_UpdateViewport(SDL_Renderer * renderer)
renderer->viewport.w, renderer->viewport.h); renderer->viewport.w, renderer->viewport.h);
} }
if (renderer->viewport.w && renderer->viewport.h) {
data->glMatrixMode(GL_PROJECTION); data->glMatrixMode(GL_PROJECTION);
data->glLoadIdentity(); data->glLoadIdentity();
if (renderer->viewport.w && renderer->viewport.h) {
if (renderer->target) {
data->glOrthof((GLfloat) 0,
(GLfloat) renderer->viewport.w,
(GLfloat) 0,
(GLfloat) renderer->viewport.h,
0.0, 1.0);
} else {
data->glOrthof((GLfloat) 0, data->glOrthof((GLfloat) 0,
(GLfloat) renderer->viewport.w, (GLfloat) renderer->viewport.w,
(GLfloat) renderer->viewport.h, (GLfloat) renderer->viewport.h,
(GLfloat) 0, 0.0, 1.0); (GLfloat) 0,
0.0, 1.0);
}
} }
return 0; return 0;
} }