Fixed an offset issue with glDrawTexiOES() when the viewport is set.
authorSam Lantinga <slouken@libsdl.org>
Thu, 10 Nov 2011 00:22:01 -0500
changeset 6075 a682a5c9a941
parent 6074 3e1323cbb807
child 6076 e69b1bd26e0b
Fixed an offset issue with glDrawTexiOES() when the viewport is set.
src/render/opengles/SDL_render_gles.c
--- a/src/render/opengles/SDL_render_gles.c	Wed Nov 09 22:53:44 2011 -0500
+++ b/src/render/opengles/SDL_render_gles.c	Thu Nov 10 00:22:01 2011 -0500
@@ -488,7 +488,7 @@
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     glOrthof((GLfloat) 0,
-			 (GLfloat) renderer->viewport.w,
+             (GLfloat) renderer->viewport.w,
              (GLfloat) renderer->viewport.h,
              (GLfloat) 0, 0.0, 1.0);
     return 0;
@@ -701,7 +701,8 @@
         cropRect[3] = -srcrect->h;
         glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES,
                                cropRect);
-        glDrawTexiOES(dstrect->x, h - dstrect->y - dstrect->h, 0,
+        glDrawTexiOES(renderer->viewport.x + dstrect->x,
+	              h - (renderer->viewport.y + dstrect->y) - dstrect->h, 0,
                             dstrect->w, dstrect->h);
     } else {