summaryrefslogtreecommitdiffstats
path: root/progs/tests/bufferobj.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-03-22 16:28:02 +0000
committerBrian Paul <[email protected]>2004-03-22 16:28:02 +0000
commitb87c5d08c778c9759011bf2e649a513aba22bd85 (patch)
treec3aa0ed6c7a41cff978c3d02af94eb6415e86104 /progs/tests/bufferobj.c
parentf6a93d3dffcd285d8c8f45d96d304caf36dd3023 (diff)
added some code to test buffer deletion
Diffstat (limited to 'progs/tests/bufferobj.c')
-rw-r--r--progs/tests/bufferobj.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/progs/tests/bufferobj.c b/progs/tests/bufferobj.c
index cd73737640a..bbfa38a1d84 100644
--- a/progs/tests/bufferobj.c
+++ b/progs/tests/bufferobj.c
@@ -46,8 +46,21 @@ static void DrawObject( const struct object *obj )
glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
glVertexPointer(3, GL_FLOAT, 0, (void *) obj->VertexOffset);
glEnable(GL_VERTEX_ARRAY);
+
+ /* test push/pop attrib */
+ /* XXX this leads to a segfault with NVIDIA's 53.36 driver */
+#if 0
+ if (1)
+ {
+ glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
+ /*glVertexPointer(3, GL_FLOAT, 0, (void *) (obj->VertexOffset + 10000));*/
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 999999);
+ glPopClientAttrib();
+ }
+#endif
glColorPointer(3, GL_FLOAT, 0, (void *) obj->ColorOffset);
glEnable(GL_COLOR_ARRAY);
+
if (obj->NumElements > 0) {
/* indexed arrays */
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, obj->ElementsBufferID);
@@ -304,6 +317,20 @@ static void Init( void )
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+ /* Test buffer object deletion */
+ if (1) {
+ static GLubyte data[1000];
+ GLuint id = 999;
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, id);
+ glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, data, GL_STATIC_DRAW_ARB);
+ glVertexPointer(3, GL_FLOAT, 0, (void *) 0);
+ glDeleteBuffersARB(1, &id);
+ /*assert(!glIsBufferARB(id));*/
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+ glVertexPointer(3, GL_FLOAT, 0, (void *) 0);
+ /*assert(!glIsBufferARB(id));*/
+ }
+
MakeObject1(Objects + 0);
MakeObject2(Objects + 1);
MakeObject3(Objects + 2);