From b87c5d08c778c9759011bf2e649a513aba22bd85 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 22 Mar 2004 16:28:02 +0000 Subject: [PATCH] added some code to test buffer deletion --- progs/tests/bufferobj.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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); -- 2.30.2