For some reason when I use a direct momory buffer with the following code nothing is drawn. The thing works just fine with a simple float[] array. Can someone see what i’m doing wrong?
public void display(GLDrawable drawable) {
final int num = 4;
final int data_len = 6;
final float[] intertwined = new float[] {
1.0f, 0.2f, 1.0f, -1.0f, -1.0f, 0.0f,
1.0f, 0.2f, 0.2f, 1.0f, -1.0f, 0.0f,
1.0f, 1.0f, 0.2f, 1.0f, 1.0f, 0.0f,
0.2f, 1.0f, 0.2f, -1.0f, 1.0f, 0.0f};
FloatBuffer direct = ByteBuffer.allocateDirect(
numdata_lenBufferUtils.SIZEOF_FLOAT).asFloatBuffer();
direct.put(intertwined);
direct.flip();
context.gl.glInterleavedArrays(GL.GL_C3F_V3F, 0, direct);
context.gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
context.gl.glLoadIdentity();
context.gl.glTranslatef(-1.5f, 0, -7);
context.gl.glBegin(GL.GL_QUADS);
context.gl.glArrayElement(0);
context.gl.glArrayElement(1);
context.gl.glArrayElement(2);
context.gl.glArrayElement(3);
context.gl.glEnd();
}
10x in advance.