Using *Pointer methods with interleaved values

In the normal C calls, the last argument of the various gl*Pointer methods you pass a pointer to the start of the array. When using interleaved data, you start with a non-zero offset into the array. For example

glVertexPointer(3, GL_FLOAT, 6sizeof(float), &interleaved[0]);
glNormalPointer(GL_FLOAT, 6
sizeof(float), &interleaved[3]);

This gives you the initial position and then stride. However, since Java does not have pointer arithmetic to play with, it seems impossible to be able to setup interleaved geometry arrays to play with. Anyone have suggestions on how this may be accomplished?

I know LWJGL uses the ByteBuffer’s position and limit for this kind of thing, but I don’t think Jogl pays attention to the position and always starts from the beginning. So I assume that the only way of doing it would be to .slice an existing buffer to start at the right position.

Exactly right. Start with one big direct byte buffer and then create an offset slice for each different bit of vertex data.

Structs! Structs! Structs! We need your votes! Reassign your generics votes!!!

Cas :slight_smile: