summaryrefslogtreecommitdiff
path: root/tests/general/vbo-map-remap.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-09-29 14:43:41 -0700
committerEric Anholt <eric@anholt.net>2009-09-29 17:26:48 -0700
commit4cfbe82bc3278321a90d30cc768f09525bd68328 (patch)
tree7880c49576216d853fd1f5124fba0b22fd32cf8b /tests/general/vbo-map-remap.c
parente144c21b764068baddc639657f965decd7102993 (diff)
Move most piglit tests to using the framework.
This saves a giant pile of code, and should encourage cleaner testcases from people writing tests in the future.
Diffstat (limited to 'tests/general/vbo-map-remap.c')
-rw-r--r--tests/general/vbo-map-remap.c49
1 files changed, 10 insertions, 39 deletions
diff --git a/tests/general/vbo-map-remap.c b/tests/general/vbo-map-remap.c
index b5c4dd2bf..7b9938224 100644
--- a/tests/general/vbo-map-remap.c
+++ b/tests/general/vbo-map-remap.c
@@ -26,22 +26,17 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static GLuint vbo;
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
- glewInit();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_require_extension("GL_ARB_vertex_buffer_object");
glGenBuffersARB(1, &vbo);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
@@ -63,8 +58,8 @@ vbo_write_floats_mapped(const float *varray, size_t count)
piglit_report_result(PIGLIT_FAILURE);
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLfloat white[4] = {1.0, 1.0, 1.0, 0.0};
GLboolean pass = GL_TRUE;
@@ -104,29 +99,5 @@ display(void)
glDisableClientState(GL_VERTEX_ARRAY);
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1],"-auto"))
- Automatic = GL_TRUE;
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("VBO map remap");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- init();
-
- piglit_require_extension("GL_ARB_vertex_buffer_object");
-
- glutMainLoop();
-
- glDeleteBuffersARB(1, &vbo);
-
- return 0;
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}