Hi,
I’ve created some vertex, colour and normal buffer objects like so:
int[] vboIds = new int[4];
gl.glGenBuffers(4,vboIds,0);
_vertexBufferIndex = vboIds[0];
gl.glBindBuffer(GL.GL_ARRAY_BUFFER,_vertexBufferIndex);
gl.glBufferData(GL.GL_ARRAY_BUFFER,
_vertexArrayByteSize,
_vertexArray,
GL.GL_STATIC_DRAW);
gl.glVertexPointer(3,GL.GL_FLOAT,0,0);
…and the same for colour and normal arrays. And then I draw them with:
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP,
numStripElements*j,
numStripElements);
Which works perfectly. Now if I create an element buffer to draw the objects like this:
_elementBufferIndex = vboIds[3];
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER,_elementBufferIndex);
gl.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER,
_elementArrayByteSize,
_elementArray,
GL.GL_STATIC_DRAW);
And draw with this:
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER,_elementBufferIndex);
gl.glDrawRangeElements(GL.GL_TRIANGLE_STRIP,min,max,num,GL.GL_INT,null);
I get the following error:
Caused by: javax.media.opengl.GLException: element vertex_buffer_object must be disabled to call this method
at com.sun.opengl.impl.GLImpl.checkBufferObject(GLImpl.java:28021)
at com.sun.opengl.impl.GLImpl.checkElementVBODisabled(GLImpl.java:28083)
at com.sun.opengl.impl.GLImpl.glDrawRangeElements(GLImpl.java:3702)
I’ve tried disabling the vertex buffer object with:
gl.glBindBuffer(GL.GL_ARRAY_BUFFER,0);
But that didn’t work. Can anyone explain what’s going on, and how to fix it?
Thanks a lot,
Chris.