From eeeed45c2cf6c876d79ae20a9a96172ece8642fe Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Jan 2009 15:47:36 -0700 Subject: i965: fix glDrawPixels Z coordinate in intel_texture_drawpixels(). As for glBitmap, it needs to be an NDC coord in [-1,1]. --- src/mesa/drivers/dri/intel/intel_pixel_draw.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 2af839b803..0e83afa645 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -71,6 +71,7 @@ intel_texture_drawpixels(GLcontext * ctx, GLuint texname; GLfloat vertices[4][4]; GLfloat texcoords[4][2]; + GLfloat z; /* We're going to mess with texturing with no regard to existing texture * state, so if there is some set up we have to bail. @@ -140,6 +141,9 @@ intel_texture_drawpixels(GLcontext * ctx, intel_meta_set_passthrough_transform(intel); + /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */ + z = -1.0 + 2.0 * ctx->Current.RasterPos[2]; + /* Create the vertex buffer based on the current raster pos. The x and y * we're handed are ctx->Current.RasterPos[0,1] rounded to integers. * We also apply the depth. However, the W component is already multiplied @@ -147,19 +151,19 @@ intel_texture_drawpixels(GLcontext * ctx, */ vertices[0][0] = x; vertices[0][1] = y; - vertices[0][2] = ctx->Current.RasterPos[2]; + vertices[0][2] = z; vertices[0][3] = 1.0; vertices[1][0] = x + width * ctx->Pixel.ZoomX; vertices[1][1] = y; - vertices[1][2] = ctx->Current.RasterPos[2]; + vertices[1][2] = z; vertices[1][3] = 1.0; vertices[2][0] = x + width * ctx->Pixel.ZoomX; vertices[2][1] = y + height * ctx->Pixel.ZoomY; - vertices[2][2] = ctx->Current.RasterPos[2]; + vertices[2][2] = z; vertices[2][3] = 1.0; vertices[3][0] = x; vertices[3][1] = y + height * ctx->Pixel.ZoomY; - vertices[3][2] = ctx->Current.RasterPos[2]; + vertices[3][2] = z; vertices[3][3] = 1.0; texcoords[0][0] = 0.0; -- cgit v1.2.3