PDA

View Full Version : glBindBufferBase error



DarkRaven
02-05-2011, 01:43 PM
Hello there.. It's very strange and maybe easy because every code I find's doing same as I am. But well I try to use GL_TRANSFORM_FEEDBACK_BUFFER and GLerror pops up after this call
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, posUpdateVBO);
error: invalid value

By documentation: GL_INVALID_VALUE is generated if index is greater than or equal to the number of target-specific indexed binding points.

I have queried version of opengl and it says 3.3... Everything should work but it doesn't.. I'm using that call twice, in both cases it gives error. I'm creating VBOs just before calling those binding : glGenBuffers(1, &posUpdateVBO);

Thanks..

Aleksandar
02-05-2011, 02:17 PM
The problem is that your buffer doesn't actually exist. :)
glGenBuffers() only allocates ID, not the buffer!
Add also something similar to this:


//...
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, posUpdateVBO);
glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, size, NULL, GL_DYNAMIC_COPY);
//...

DarkRaven
02-05-2011, 03:09 PM
Ah great.. :)
I think there should be new error for bindBufferBase regarding to buffer object because I really thought it's again something screwed up in my driver and wasn't checking the BO actually..

thanks

Alfonse Reinheart
02-05-2011, 05:21 PM
The spec says that GL_INVALID_VALUE will be generated if the "size" parameter of glBindBufferRange is zero. And since the spec also says that glBindBufferSize "is the equivalent of calling glBindBufferRange with offset zero and size equal to the size of the buffer." Therefore, since your buffer has a zero size, you get a GL_INVALID_VALUE

Whoever wrote the "documentation (http://www.opengl.org/sdk/docs/man3/)" really dropped the ball on the error section. And not just for this function.

DarkRaven
02-06-2011, 09:12 AM
Uhm.. I got fixed that BufferBase but next error pops on glBeginTransformFeedback(GL_POINTS);

Acording to documentation "GL_INVALID_OPERATION is generated if glBeginTransformFeedback is executed while transform feedback is active."

So tried to put glEndTransformFeedback() just before and it still gives error. I've properly set varyings in shaders, allowed them to be used for feedback in GLSL program, buffer objects are also running now.. I'm really lost trying to figure out setting up of transform feedback with scrap of code - the only thing I found with google.

Any kind person who got some real code and wouldn't mind showing it to me? :)