diff options
author | Brian Paul <[email protected]> | 2003-10-21 14:56:53 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-10-21 14:56:53 +0000 |
commit | 35b52c72d007ef2c813ab9273b9678043f278196 (patch) | |
tree | 74eab9e2235721643ec18fb816b28c8ef1016bf1 /progs/tests/bufferobj.c | |
parent | b4590f1c94872dd61a291b12ba0c609fbfafe711 (diff) |
added more debug code and tests
Diffstat (limited to 'progs/tests/bufferobj.c')
-rw-r--r-- | progs/tests/bufferobj.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/progs/tests/bufferobj.c b/progs/tests/bufferobj.c index df7d57f8e0a..cd73737640a 100644 --- a/progs/tests/bufferobj.c +++ b/progs/tests/bufferobj.c @@ -161,10 +161,28 @@ static void MakeObject1(struct object *obj) GLfloat *v, *c; void *p; int i; + GLubyte buffer[500]; + + for (i = 0; i < 500; i++) + buffer[i] = i & 0xff; glGenBuffersARB(1, &obj->BufferID); glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, NULL, GL_STATIC_DRAW_ARB); + glBufferDataARB(GL_ARRAY_BUFFER_ARB, 500, buffer, GL_STATIC_DRAW_ARB); + + for (i = 0; i < 500; i++) + buffer[i] = 0; + + glGetBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 500, buffer); + + for (i = 0; i < 500; i++) + assert(buffer[i] == (i & 0xff)); + + glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i); + assert(!i); + + glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_USAGE_ARB, &i); + v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); /* do some sanity tests */ @@ -172,14 +190,14 @@ static void MakeObject1(struct object *obj) assert(p == v); glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &i); - assert(i == 1000); - - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_ACCESS_ARB, &i); - assert(i == GL_WRITE_ONLY_ARB); + assert(i == 500); glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_USAGE_ARB, &i); assert(i == GL_STATIC_DRAW_ARB); + glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_ACCESS_ARB, &i); + assert(i == GL_WRITE_ONLY_ARB); + glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i); assert(i); |