summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-03-10 10:31:01 -0700
committerBrian Paul <brianp@vmware.com>2010-03-10 10:39:45 -0700
commit8d3f629a13afb0d6acafc7a007972fdc5efe6847 (patch)
tree45968ea67ce050f62522de36992ced7b26f040c8
parentb98ef495d44850cd992e59beae4141ce3dcb70a3 (diff)
st/mesa: fix incorrect glDrawPixels into FBO
We weren't inverting the textured quad when drawing into an fbo.
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 3b162d1dad..8399f6f71b 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -434,7 +434,7 @@ make_texture(struct st_context *st,
/**
* Draw quad with texcoords and optional color.
- * Coords are window coords with y=0=bottom.
+ * Coords are gallium window coords with y=0=top.
* \param color may be null
* \param invertTex if true, flip texcoords vertically
*/
@@ -621,10 +621,15 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
pipe->set_sampler_textures(pipe, 1, &pt);
}
- /* Compute window coords (y=0=bottom) with pixel zoom.
+ /* Compute Gallium window coords (y=0=top) with pixel zoom.
* Recall that these coords are transformed by the current
* vertex shader and viewport transformation.
*/
+ if (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM) {
+ y = ctx->DrawBuffer->Height - (int) (y + height * ctx->Pixel.ZoomY);
+ invertTex = !invertTex;
+ }
+
x0 = (GLfloat) x;
x1 = x + width * ctx->Pixel.ZoomX;
y0 = (GLfloat) y;