[Piglit] [PATCH 02/16] util: Refactor desktop OpenGL draw_rect code to use piglit_draw_rect_from_arrays

Ian Romanick idr at freedesktop.org
Mon Aug 26 11:37:01 PDT 2013


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Matt Turner <mattst88 at gmail.com>
Cc: Paul Berry <stereoytpe441 at gmail.com>
---
 tests/util/piglit-util-gl.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 3dbeec8..cf6e599 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -864,12 +864,7 @@ piglit_draw_rect(float x, float y, float w, float h)
 	verts[3][2] = 0.0;
 	verts[3][3] = 1.0;
 
-	glVertexPointer(4, GL_FLOAT, 0, verts);
-	glEnableClientState(GL_VERTEX_ARRAY);
-
-	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
-	glDisableClientState(GL_VERTEX_ARRAY);
+	piglit_draw_rect_from_arrays(verts, NULL);
 }
 
 /**
@@ -897,12 +892,7 @@ piglit_draw_rect_z(float z, float x, float y, float w, float h)
 	verts[3][2] = z;
 	verts[3][3] = 1.0;
 
-	glVertexPointer(4, GL_FLOAT, 0, verts);
-	glEnableClientState(GL_VERTEX_ARRAY);
-
-	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
-	glDisableClientState(GL_VERTEX_ARRAY);
+	piglit_draw_rect_from_arrays(verts, NULL);
 }
 
 /**
@@ -941,15 +931,7 @@ piglit_draw_rect_tex(float x, float y, float w, float h,
 	tex[3][0] = tx + tw;
 	tex[3][1] = ty + th;
 
-	glVertexPointer(4, GL_FLOAT, 0, verts);
-	glTexCoordPointer(2, GL_FLOAT, 0, tex);
-	glEnableClientState(GL_VERTEX_ARRAY);
-	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-
-	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
-	glDisableClientState(GL_VERTEX_ARRAY);
-	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+	piglit_draw_rect_from_arrays(verts, tex);
 }
 
 
-- 
1.8.1.4



More information about the Piglit mailing list