Login  Register

Error: buffer for target not bound

Posted by aeonios on Aug 13, 2016; 9:55pm
URL: https://forum.jogamp.org/Error-buffer-for-target-not-bound-tp4037061.html

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.