diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c index 9b725970d..b8b8c1d49 100644 --- a/src/render/opengles/SDL_render_gles.c +++ b/src/render/opengles/SDL_render_gles.c @@ -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; }