Fixed bug 1844 - glScissor calls are wrong - Patch attached
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 12 May 2013 13:40:02 +0200
changeset 7169 d27e9ee7310f
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
--- a/src/render/opengl/SDL_render_gl.c	Sun May 12 13:25:34 2013 +0200
+++ b/src/render/opengl/SDL_render_gl.c	Sun May 12 13:40:02 2013 +0200
@@ -794,7 +794,8 @@
 
     if (!SDL_RectEmpty(rect)) {
         data->glEnable(GL_SCISSOR_TEST);
-        data->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
+        int lowerLeft = renderer->viewport.h - rect->y - rect->h;
+        data->glScissor(rect->x, lowerLeft, rect->w, rect->h);
     } else {
         data->glDisable(GL_SCISSOR_TEST);
     }
--- a/src/render/opengles/SDL_render_gles.c	Sun May 12 13:25:34 2013 +0200
+++ b/src/render/opengles/SDL_render_gles.c	Sun May 12 13:40:02 2013 +0200
@@ -645,7 +645,8 @@
 
     if (!SDL_RectEmpty(rect)) {
         data->glEnable(GL_SCISSOR_TEST);
-        data->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
+        int lowerLeft = renderer->viewport.h - rect->y - rect->h;
+        data->glScissor(rect->x, lowerLeft, rect->w, rect->h);
     } else {
         data->glDisable(GL_SCISSOR_TEST);
     }
--- a/src/render/opengles2/SDL_render_gles2.c	Sun May 12 13:25:34 2013 +0200
+++ b/src/render/opengles2/SDL_render_gles2.c	Sun May 12 13:40:02 2013 +0200
@@ -288,7 +288,8 @@
 
     if (!SDL_RectEmpty(rect)) {
         rdata->glEnable(GL_SCISSOR_TEST);
-        rdata->glScissor(rect->x, rect->h - rect->y, rect->w, rect->h);
+        int lowerLeft = renderer->viewport.h - rect->y - rect->h;
+        rdata->glScissor(rect->x, lowerLeft, rect->w, rect->h);
     } else {
         rdata->glDisable(GL_SCISSOR_TEST);
     }