[Piglit] [PATCH 3/4] copytemimage: Use glDrawArrays instead of piglit_draw_rect.

Eric Anholt eric at anholt.net
Fri Jun 21 14:21:24 PDT 2013


In the subject, "copyteximage" not "copytemimage" :)

Fabian Bieler <fabianbieler at fastmail.fm> writes:

> Don't mix piglit_draw_rect and additional attribute arrays.
> ---
>  tests/texturing/copyteximage.c | 45 ++++++++++++++++++++++++++----------------
>  1 file changed, 28 insertions(+), 17 deletions(-)
>
> diff --git a/tests/texturing/copyteximage.c b/tests/texturing/copyteximage.c
> index 432ebbc..8a5b534 100644
> --- a/tests/texturing/copyteximage.c
> +++ b/tests/texturing/copyteximage.c
> @@ -430,6 +430,26 @@ static GLboolean probe_rect(int x, int y, int w, int h,
>  	return piglit_probe_rect_rgba(x, y, w, h, expected_scaled);
>  }
>  
> +/**
> + * Draw a rectangle with texture coordiantes and width and height IMAGE_SIZE.
> + *
> + * texCoordDim -- the number of components of the texture coordinates
> + * texCoords -- an array of floats with texture coordinate data
> + * x, y -- the lower left corner of the rectangle
> + */
> +static void
> +draw_rect_tex(GLint texCoordDim, const GLvoid *texCoords, GLint x, GLint y)
> +{
> +	const float s = IMAGE_SIZE;
> +	float verts[4][4] = { {x,   y,   0, 1},
> +			      {x+s, y,   0, 1},
> +			      {x+s, y+s, 0, 1},
> +			      {x,   y+s, 0, 1} };
> +
> +	glTexCoordPointer(texCoordDim, GL_FLOAT, 0, texCoords);
> +	glVertexPointer(4, GL_FLOAT, 0, verts);
> +	glDrawArrays(GL_QUADS, 0, 4);
> +}

Possible variant: the texCoordDim == 2 case could be done by
piglit_draw_rect_tex, making this just a local draw_rect_tex_3d
function.

Either way,

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130621/fe1cffae/attachment.pgp>


More information about the Piglit mailing list