Okay, everything makes sense for the most part. I’ve created an IntBuffer to use for my indices. First I tried replacing this gl code:
glDrawElements(GL_TRIANGLE_STRIP, 80, GL_UNSIGNED_INT, &Inidices[0]);
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, &Inidices[80]);
with this java code:
gl.glDrawElements(GL.GL_TRIANGLE_STRIP, 80, GL.GL_UNSIGNED_INT, indexBuffer.position(0));
gl.glDrawElements(GL.GL_TRIANGLE_STRIP, 4, GL.GL_UNSIGNED_INT, indexBuffer.position(80));
this draws the first call, but not the second. I guess this is what Tom means when he says JOGL doesn’t respect position and limit. fine. so than I tried:
gl.glDrawElements(GL.GL_TRIANGLE_STRIP, 80, GL.GL_UNSIGNED_INT, indexBuffer.position(0).slice());
gl.glDrawElements(GL.GL_TRIANGLE_STRIP, 4, GL.GL_UNSIGNED_INT, indexBuffer.position(80).slice());
but this gives an error because position returns a Buffer not an IntBuffer and slice is not defined for Buffer. What worked is this:
IntBuffer slc;
indexBuffer.position(0);
slc = indexBuffer.slice();
gl.glDrawElements(GL.GL_TRIANGLE_STRIP, 80, GL.GL_UNSIGNED_INT, slc);
indexBuffer.position(80);
slc = indexBuffer.slice();
gl.glDrawElements(GL.GL_TRIANGLE_STRIP, 4, GL.GL_UNSIGNED_INT, slc);
I could not figure out how to cast indexBuffer.position().slice() to an IntBuffer. Is there a way to do this all on one line? The reason being I have several lines from several C code opengl files that I need to convert to java using grep and I’m not that good a scripting, so I’m just trying to convert them line for line, rather than turning the 2 lines of code into 6.
Does anybody have any suggestions of a way to do this, or do I have to dust off my perl manual?
thanks for replies, rob