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 6075a682a5c9a941
parent 6074 3e1323cbb807
child 6076 e69b1bd26e0b
Fixed an offset issue with glDrawTexiOES() when the viewport is set.
src/render/opengles/SDL_render_gles.c
     1.1 --- a/src/render/opengles/SDL_render_gles.c	Wed Nov 09 22:53:44 2011 -0500
     1.2 +++ b/src/render/opengles/SDL_render_gles.c	Thu Nov 10 00:22:01 2011 -0500
     1.3 @@ -488,7 +488,7 @@
     1.4      glMatrixMode(GL_PROJECTION);
     1.5      glLoadIdentity();
     1.6      glOrthof((GLfloat) 0,
     1.7 -			 (GLfloat) renderer->viewport.w,
     1.8 +             (GLfloat) renderer->viewport.w,
     1.9               (GLfloat) renderer->viewport.h,
    1.10               (GLfloat) 0, 0.0, 1.0);
    1.11      return 0;
    1.12 @@ -701,7 +701,8 @@
    1.13          cropRect[3] = -srcrect->h;
    1.14          glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES,
    1.15                                 cropRect);
    1.16 -        glDrawTexiOES(dstrect->x, h - dstrect->y - dstrect->h, 0,
    1.17 +        glDrawTexiOES(renderer->viewport.x + dstrect->x,
    1.18 +	              h - (renderer->viewport.y + dstrect->y) - dstrect->h, 0,
    1.19                              dstrect->w, dstrect->h);
    1.20      } else {
    1.21