Any good documentation on VertexArrays in jogl?

Hi all!
I was trying a bit on creating a 4D-Viewer but soon got problems with lack of framerate. Since it was a raw version I decided to implement Arrays for the untextured Objects (About 150.000 vertices, completly in triangles) normals and vertices.
I collected all the necessary data in four Arrays, the normalValues and vertexValues-Arrays of type float[] and the normalIndices and vertexIndices-Arrays of type int[]. Now I tried binding the float-arrays using something like this:


gl.glEnableClientState(GL.GL_NORMAL_ARRAY);
gl.glEnableClientState(GL.GL_VERTEX_ARRAY);

FloatBuffer normalBuffer = BufferUtils.newFloatBuffer(normalArray.length);
normalBuffer.put(normalArray);
FloatBuffer vertexBuffer = BufferUtils.newFloatBuffer(vertexArray.length);
vertexBuffer.put(vertexArray);

gl.glNormalPointer(3, GL.GL_FLOAT, normalBuffer);
gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertexBuffer);

When I run this I get an

net.java.games.jogl.GLException: Error freeing OpenGL context

I’m not quite sure about this so I was wondering if there is a good demonstrational solution out there I could use for a better understanding what needs to done on java where one cannot simply use some pointer-arithmetics for buffer-playing…
Any suggestions welcome!

Greetz…

…Hoschi

change from

gl.glNormalPointer(3, GL.GL_FLOAT, normalBuffer); 

to

gl.glNormalPointer(GL.GL_FLOAT, 0, normalBuffer);

Normals always have 3 values per vertex.

Thanks for the quick response. Of course you are right. But fixing this minor problem sadly enough does not fix the overall problem. I still get the errorMessage.
Any further suggestions?

Greetz…

…Hoschi

       try {

//Make your calls to jogl display method here
} catch (Throwable t) {
t.printStackTrace();
}

This will allow you to see the real error instead of just seeing jogl’s buffer swap error. An exception is being thrown in your code (probably null pointer or arrayindexoutofbounds or something similar) and jogl seems to have a catchall. As a side note because jogl won’t receive the exception your program will continue to run and strange things may happen as a result of this code, so once the exception is thrown be ready to stop your program as the exception will probably repeat indefinitely.