[Piglit] [PATCH 11/16] Move piglit_draw_triangle* helper functions to GL common code

Josh Triplett josh at joshtriplett.org
Thu Jul 3 12:38:08 PDT 2014


These don't need to remain in the GL-specific utility library.

Signed-off-by: Josh Triplett <josh at joshtriplett.org>
---
 tests/util/piglit-util-gl-common.c | 40 ++++++++++++++++++++++++++++++++++++++
 tests/util/piglit-util-gl.c        | 40 --------------------------------------
 2 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
index c00c9c7..f84fd2c 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -1877,3 +1877,43 @@ GLuint piglit_compile_program(GLenum target, const char* text)
 
 	return program;
 }
+
+/**
+ * Convenience function to draw a triangle.
+ */
+GLvoid
+piglit_draw_triangle(float x1, float y1, float x2, float y2,
+		     float x3, float y3)
+{
+	piglit_draw_triangle_z(0.0, x1, y1, x2, y2, x3, y3);
+}
+
+/**
+ * Convenience function to draw a triangle at a given depth.
+ */
+GLvoid
+piglit_draw_triangle_z(float z, float x1, float y1, float x2, float y2,
+		     float x3, float y3)
+{
+	float verts[3][4];
+
+	verts[0][0] = x1;
+	verts[0][1] = y1;
+	verts[0][2] = z;
+	verts[0][3] = 1.0;
+	verts[1][0] = x2;
+	verts[1][1] = y2;
+	verts[1][2] = z;
+	verts[1][3] = 1.0;
+	verts[2][0] = x3;
+	verts[2][1] = y3;
+	verts[2][2] = z;
+	verts[2][3] = 1.0;
+
+	glVertexPointer(4, GL_FLOAT, 0, verts);
+	glEnableClientState(GL_VERTEX_ARRAY);
+
+	glDrawArrays(GL_TRIANGLES, 0, 3);
+
+	glDisableClientState(GL_VERTEX_ARRAY);
+}
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index bec2940..346a985 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -37,46 +37,6 @@
 
 
 /**
- * Convenience function to draw a triangle.
- */
-GLvoid
-piglit_draw_triangle(float x1, float y1, float x2, float y2,
-		     float x3, float y3)
-{
-	piglit_draw_triangle_z(0.0, x1, y1, x2, y2, x3, y3);
-}
-
-/**
- * Convenience function to draw a triangle at a given depth.
- */
-GLvoid
-piglit_draw_triangle_z(float z, float x1, float y1, float x2, float y2,
-		     float x3, float y3)
-{
-	float verts[3][4];
-
-	verts[0][0] = x1;
-	verts[0][1] = y1;
-	verts[0][2] = z;
-	verts[0][3] = 1.0;
-	verts[1][0] = x2;
-	verts[1][1] = y2;
-	verts[1][2] = z;
-	verts[1][3] = 1.0;
-	verts[2][0] = x3;
-	verts[2][1] = y3;
-	verts[2][2] = z;
-	verts[2][3] = 1.0;
-
-	glVertexPointer(4, GL_FLOAT, 0, verts);
-	glEnableClientState(GL_VERTEX_ARRAY);
-
-	glDrawArrays(GL_TRIANGLES, 0, 3);
-
-	glDisableClientState(GL_VERTEX_ARRAY);
-}
-
-/**
  * Generate a checkerboard texture
  *
  * \param tex                Name of the texture to be used.  If \c tex is
-- 
2.0.1



More information about the Piglit mailing list