Fixed bug 1844 - glScissor calls are wrong - Patch attached
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 12 May 2013 13:40:02 +0200
changeset 7169d27e9ee7310f
parent 7168 b9070b2e868a
child 7170 d5f5a491fe49
Fixed bug 1844 - glScissor calls are wrong - Patch attached

Martin Gerhardy

the coordinate system from sdl is not correctly transformed to the coordinate system of opengl. glScissor expects them to be a little bit different. Attached is a patch that fixes this
src/render/opengl/SDL_render_gl.c
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
     1.1 --- a/src/render/opengl/SDL_render_gl.c	Sun May 12 13:25:34 2013 +0200
     1.2 +++ b/src/render/opengl/SDL_render_gl.c	Sun May 12 13:40:02 2013 +0200
     1.3 @@ -794,7 +794,8 @@
     1.4  
     1.5      if (!SDL_RectEmpty(rect)) {
     1.6          data->glEnable(GL_SCISSOR_TEST);
     1.7 -        data->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
     1.8 +        int lowerLeft = renderer->viewport.h - rect->y - rect->h;
     1.9 +        data->glScissor(rect->x, lowerLeft, rect->w, rect->h);
    1.10      } else {
    1.11          data->glDisable(GL_SCISSOR_TEST);
    1.12      }
     2.1 --- a/src/render/opengles/SDL_render_gles.c	Sun May 12 13:25:34 2013 +0200
     2.2 +++ b/src/render/opengles/SDL_render_gles.c	Sun May 12 13:40:02 2013 +0200
     2.3 @@ -645,7 +645,8 @@
     2.4  
     2.5      if (!SDL_RectEmpty(rect)) {
     2.6          data->glEnable(GL_SCISSOR_TEST);
     2.7 -        data->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
     2.8 +        int lowerLeft = renderer->viewport.h - rect->y - rect->h;
     2.9 +        data->glScissor(rect->x, lowerLeft, rect->w, rect->h);
    2.10      } else {
    2.11          data->glDisable(GL_SCISSOR_TEST);
    2.12      }
     3.1 --- a/src/render/opengles2/SDL_render_gles2.c	Sun May 12 13:25:34 2013 +0200
     3.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Sun May 12 13:40:02 2013 +0200
     3.3 @@ -288,7 +288,8 @@
     3.4  
     3.5      if (!SDL_RectEmpty(rect)) {
     3.6          rdata->glEnable(GL_SCISSOR_TEST);
     3.7 -        rdata->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
     3.8 +        int lowerLeft = renderer->viewport.h - rect->y - rect->h;
     3.9 +        rdata->glScissor(rect->x, lowerLeft, rect->w, rect->h);
    3.10      } else {
    3.11          rdata->glDisable(GL_SCISSOR_TEST);
    3.12      }