Error: buffer for target not bound

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error: buffer for target not bound

aeonios
I've recently attempted to upgrade some ancient software from JOGL 1.1.1 to the latest stable. Thus far I haven't had too many issues but this one I don't really understand. Basically the code looks like this:

(where vbo is a FloatBuffer[])
boolean isNewArray = (vboID[lodLevel][index] < 0);

                if (isNewArray)
                        gl.glGenBuffers(1, vboID[lodLevel], index);

                gl.glBindFramebuffer(GL2.GL_ARRAY_BUFFER, vboID[lodLevel][index]);

                if (isNewArray)
                        gl.glBufferData(GL2.GL_ARRAY_BUFFER, verticesPerBlock[lodLevel] * 8 * GLBuffers.SIZEOF_FLOAT, vbo[lodLevel], GL2.GL_DYNAMIC_DRAW);
                else
                        gl.glBufferSubData(GL2.GL_ARRAY_BUFFER, 0, verticesPerBlock[lodLevel] * 8 * GLBuffers.SIZEOF_FLOAT, vbo[lodLevel]);

which crashes on gl.glBufferData() saying that the buffer for the target isn't bound. This same code (with the only difference being that GL2 was GL) worked fine under JOGL 1.1.1. I suspect it may have to do with attempting to use glBindFramebuffer for a VBO but I don't know the proper way of handling that.
Reply | Threaded
Open this post in threaded view
|

Re: Error: buffer for target not bound

gouessej
Administrator
Hi

Please provide a SSCCE so that we can clearly identify the culprit.

I had no such problems when porting my game from JOGL 1.1.1 to JOGL 2 whereas it heavily uses VBOs but I don't use glBindFramebuffer. In my humble opinion, you still have to bind a buffer (not a frame buffer) before calling glBufferData. You should use glGenFramebuffers with glBindFramebuffer and glGenBuffers with glBindBuffer. In my humble opinion, it luckily worked with JOGL 1.1.1 not because it is an ancient version but because you were lucky enough to get a buffer name valid as a frame buffer name too.
Julien Gouesse | Personal blog | Website