Hello everyone,
I'm working on a 3D renderer and everything worked fine with the older version of JOGL (it says version 2.0 on the ReadMe), then recently I used the current release and I'm now getting a GLException saying "element vertex_buffer_object must be disabled to call this method." I'm sure I've encountered this exception before and I was able to fix it with a call to gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, 0) before drawing but now the problem is persistent. Everything works fine when I run a test on the older JOGL using the same code, so now I'm not sure where the problem lies. I've already spent an entire day scrounging the web for information and still can't fix the problem so any help would be much appreciated. Here's how the code looks like: //vao and vbos setup int[] vao = new int[1]; gl.glGenVertexArrays(1, vao, 0); gl.glBindVertexArray(vao[0]); int[] ibo = new int[1]; gl.glGenBuffers(1, ibo, 0); gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, ibo[0]); gl.glBufferData(GL4.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.capacity() * 4, indexBuffer, GL4.GL_STATIC_DRAW); int[] vbo = new int[1]; gl.glGenBuffers(1, vbo, 0); gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vbo[0]); gl.glBufferData(GL4.GL_ARRAY_BUFFER, coordBuffer.capacity() * 4, coordinatesBuffer, GL4.GL_STATIC_DRAW); gl.glVertexAttribPointer(coordAttribLoc, 3, GL4.GL_FLOAT, false, 0, 0); gl.glEnableVertexAttribArray(coordAttribLoc); int[] nbo = new int[1]; gl.glGenBuffers(1, nbo, 0); gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, nbo[0]); gl.glBufferData(GL4.GL_ARRAY_BUFFER, normalBuffer.capacity() * 4, normalBuffer(), GL4.GL_STATIC_DRAW); gl.glVertexAttribPointer(normalAttribLoc, 3, GL4.GL_FLOAT, false, 0, 0); gl.glEnableVertexAttribArray(normalAttribLoc); int[] cbo = new int[1]; gl.glGenBuffers(1, cbo, 0); gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, cbo[0]); gl.glBufferData(GL4.GL_ARRAY_BUFFER, colorBuffer.capacity() * 4, colorBuffer, GL4.GL_STATIC_DRAW); gl.glVertexAttribPointer(colorAttribLoc, 4, GL4.GL_FLOAT, false, 0, 0); gl.glEnableVertexAttribArray(colorAttribLoc); int[] tbo = new int[1]; gl.glGenBuffers(1, tbo, 0); gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, tbo[0]); gl.glBufferData(GL4.GL_ARRAY_BUFFER, textureCoordBuffer().capacity() * 4, textureCoordBuffer(), GL4.GL_STATIC_DRAW); gl.glVertexAttribPointer(texCoordAttribLoc, 2, GL4.GL_FLOAT, false, 0, 0); gl.glEnableVertexAttribArray(texCoordAttribLoc); gl.glBindVertexArray(0); gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, 0); gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, 0); . . . //drawing gl.glBindVertexArray(vao[0]); gl.glDrawRangeElements(GL4.GL_TRIANGLES, 0, coordCount, indexCount, GL4.GL_UNSIGNED_INT, null); This is basically the code inside the rendering loop. Thanks and more power to the JOGL team! |
Administrator
|
Can you try with the RC12 in order to check whether something has been broken recently?
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |