[LWJGL] interleaved VBO (textured quad) (help with Indices)

So I decided to try to update my method of using VBO’s, as apparently I was using a deprecated method which doesn’t work well on the core version of openGL (on this computer).

Upon looking at this example: http://www.lwjgl.org/wiki/index.php?title=The_Quad_textured which uses the updated method, I noticed something I hadn’t used before. Indices. It’s pretty well explained in that example, but what I haven’t been able to understand, is why it seems to require a byteBuffer. When I change it to say an IntBuffer, or a FloatBuffer, the quad no longer renders.

Why is this?

GL11.glDrawElements(GL11.GL_TRIANGLES, indicesCount, GL11.GL_UNSIGNED_BYTE, 0);

See the GL_UNSIGNED_BYTE? Change that to GL_UNSIGNED_INT to specify the indices data type. You can then change the type to a floatbuffer. Also, indices shouldn’t be a floatbuffer. It is sort of hard to have half a vertex :wink:

I feel dumb… that should have been an easy catch xD

Thanks! :slight_smile:

[edit]
The only reason I would ever think of a float buffer, is because they have a larger maximum value than an int (afaik). BUT, I forgot Java doesn’t use the typical 4byte integer… so it’s maximum value is fine :slight_smile: