Skip to content

Commit

Permalink
Fixed bug 3347 - OpenGL ES renderer doesn't flip projection matrix fo…
Browse files Browse the repository at this point in the history
…r 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.
  • Loading branch information
slouken committed Oct 1, 2016
1 parent 061cc5e commit 89c868f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/render/opengles/SDL_render_gles.c
Expand Up @@ -676,13 +676,22 @@ GLES_UpdateViewport(SDL_Renderer * renderer)
renderer->viewport.w, renderer->viewport.h);
}

data->glMatrixMode(GL_PROJECTION);
data->glLoadIdentity();
if (renderer->viewport.w && renderer->viewport.h) {
data->glMatrixMode(GL_PROJECTION);
data->glLoadIdentity();
data->glOrthof((GLfloat) 0,
(GLfloat) renderer->viewport.w,
(GLfloat) renderer->viewport.h,
(GLfloat) 0, 0.0, 1.0);
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,
(GLfloat) renderer->viewport.w,
(GLfloat) renderer->viewport.h,
(GLfloat) 0,
0.0, 1.0);
}
}
return 0;
}
Expand Down

0 comments on commit 89c868f

Please sign in to comment.