summaryrefslogtreecommitdiff
path: root/tests/general/object_purgeable-api-vbo.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-05 13:35:30 -0800
committerIan Romanick <ian.d.romanick@intel.com>2010-03-05 13:35:30 -0800
commit96f011b3cd44c10d94a108ebde500b43c136f46f (patch)
tree5286e0fb217abcab01d1ee3e856d2e5a73cec851 /tests/general/object_purgeable-api-vbo.c
parent5ec9b9e1f1067467180fe63e994ba3483fa1874d (diff)
object_purgeable: Use piglit test framework
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'tests/general/object_purgeable-api-vbo.c')
-rw-r--r--tests/general/object_purgeable-api-vbo.c79
1 files changed, 16 insertions, 63 deletions
diff --git a/tests/general/object_purgeable-api-vbo.c b/tests/general/object_purgeable-api-vbo.c
index 10af569ca..e300b9d0b 100644
--- a/tests/general/object_purgeable-api-vbo.c
+++ b/tests/general/object_purgeable-api-vbo.c
@@ -32,57 +32,34 @@
#include "piglit-util.h"
#include "object_purgeable.h"
-// GL_ARB_vertex_buffer_object GL_ARB_pixel_buffer_object
-static PFNGLBINDBUFFERARBPROC pglBindBufferARB = NULL;
-static PFNGLDELETEBUFFERSARBPROC pglDeleteBuffersARB = NULL;
-static PFNGLGENBUFFERSARBPROC pglGenBuffersARB = NULL;
-static PFNGLBUFFERDATAARBPROC pglBufferDataARB = NULL;
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB;
-
-static GLboolean Automatic = GL_FALSE;
-
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
init_ObjectPurgeableAPI();
+ piglit_automatic = GL_TRUE;
piglit_require_extension("GL_ARB_vertex_buffer_object");
-
- pglGenBuffersARB = (PFNGLGENBUFFERSARBPROC) piglit_get_proc_address("glGenBuffersARB");
- pglBindBufferARB = (PFNGLBINDBUFFERARBPROC) piglit_get_proc_address("glBindBufferARB");
- pglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) piglit_get_proc_address("glDeleteBuffersARB");
- pglBufferDataARB = (PFNGLBUFFERDATAARBPROC) piglit_get_proc_address("glBufferDataARB");
-
- glClearColor(0.1, 0.1, 0.3, 0.0);
}
-static void
-reshape(int width, int height)
-{
- glViewport(0, 0, (GLint) width, (GLint) height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLuint vbo;
GLboolean pass = GL_TRUE;
- glClear(GL_COLOR_BUFFER_BIT);
-
glGetError();
- (*pglGenBuffersARB)(1, &vbo);
- (*pglBindBufferARB)(GL_ARRAY_BUFFER_ARB, vbo);
- (*pglBufferDataARB)(GL_ARRAY_BUFFER_ARB, 100*100, NULL, GL_STATIC_DRAW_ARB);
- (*pglBindBufferARB)(GL_ARRAY_BUFFER_ARB, 0);
+ glGenBuffersARB(1, &vbo);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
+ glBufferDataARB(GL_ARRAY_BUFFER_ARB, 100*100, NULL, GL_STATIC_DRAW_ARB);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_FALSE) != GL_TRUE) {
@@ -131,30 +108,6 @@ display(void)
}
- (*pglDeleteBuffersARB)(1, &vbo);
-
-
- 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;
-
- glutInitWindowSize(400, 300);
- glutInitDisplayMode(GLUT_RGB);
- glutCreateWindow("GL_APPLE_object_purgeable API test with GL_ARB_vertex_buffer_object");
- glutReshapeFunc(reshape);
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
-
- init();
-
- glutMainLoop();
- return 0;
+ glDeleteBuffersARB(1, &vbo);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}