I have a strange problem with VBO, making my openGL library to crash.
What I want to do is to map into the client’s address space an “array indices”.
Here is my code:
glGenBuffersARB(1,&data);
glBindBufferARB(GL_ARRAY_BUFFER_ARB,&data);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, bufferData, GL_DYNAMIC_DRAW_ARB);
pData = glMapBufferARB(GL_ARRAY_BUFFER_ARB,GL_READ_WRITE_ARB);
// Everything is fine!
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
glBindBufferARB(GL_ARRAY_BUFFER_ARB,0);
Originally posted by Evan Meakyl: What am I doing wrong?
When you declare something like :
GLuint data;
the value of this data is ‘data’ and the pointer is ‘&data’, right ?
So, what you wrote here is correct :
glGenBuffersARB(1,&data);
But what you wrote here is NOT correct :
glBindBufferARB(GL_ARRAY_BUFFER_ARB,&data);
You may write instead :
glBindBufferARB(GL_ARRAY_BUFFER_ARB,data);
Note that you’ve done the same mistake in both vertex buffer objects. If it works for the first and crashes for the second, it’s just a matter of chance because both is incorrect.
[This message has been edited by vincoof (edited 09-03-2003).]
You’re right - but it is a typo mistake in the example I gave you (It’s not my real program…)
I found that when I do a
glGetBufferParameterivARB( GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &Size );
just after the glBufferDataARB, the size is 0…
But in the registry we can read:
“BufferDataARB returns no value and sets OUT_OF_MEMORY if the buffer could not be created”.
In this case, I think the buffer isn’t created, because its size is 0 which is a bit different from what I wanted… but I have no OpenGL error (I’ve checked).
Not really … I am using ATI openGL library on Windows, with my All In Wonder Radeon 32 Mo ddr.
For me, it was a bug in the driver, but if you’ve got the same result with another implementation, it looks like it’s us who are doing something wrong…