Ah, you're using JOGL. BufferUtil is part of LWJGL, which is an alternative to JOGL. Personally I prefer LWJGL, but you can just make your own utility class for buffer creation. To create other buffers (FloatBuffer for example) just create a ByteBuffer (with the code I posted) with 4 times the size (as you'll need 4 bytes per float) and use asFloatBuffer().
wait, what?!? BufferUtil is part of JOGL... it is in: com.sun.opengl.util.BufferUtil
So this is what I usually do:
1
| vertices = ByteBuffer.allocateDirect(totalBuffer * BufferUtil.SIZEOF_FLOAT).order(ByteOrder.nativeOrder()).asFloatBuffer(); |
You also need to remember to 'rewind' the buffer, I think: