Following up the accepted answer on Is there any difference between giving GL15.glBufferData() a float array or a FloatBuffer in LWJGL 3.0?, I understand that ideally you should use a Buffer
instead of an array of primitives when using GL15.glBufferData()
for optimal performance. However, looking at an example on the LWJGL wiki, it looks like they just use primitives that then are used to create a Buffer
, which according to the aforementioned answer would negate the performance benefits of using a Buffer
in the first place.
Which leads me to the question: If I have a static set of data (like the vertices in the linked example), what's the optimal way to populate my Buffer
with this data? Should I just create a buffer with BufferUtils
and then use put()
to populate it with my primitive array, or is there a better way that allows me to avoid the primitive array altogether? In my case I have floats, but I presume it'll be the same regardless of data type.