Buffer.flip()

Why is it so important? I mean, I use it because I have to, I read the source to see what it does and the comments but I still can’t quite see how it relates to the ‘real world’ so that I understand exactly why it is so important…

EDIT: To be more specific, why does it matter so much what the position, limit and mark is when I call some LWJGL function to get it to work right? Why isn’t the data just read from begin to end anyway?

Maybe I’m just stupid :-[

Erik

Buffer reuse maybe? By fiddling with the current position you could avoid writing parts of structures that never change and leave them many structs in a single buffer… making less garbage…?? I don’t know… I’m just guessing at potential benefits…

To LWJGL, I believe mark is irrelevant. Limit isn’t being checked at the moment, but may be in the future?

Position is used C-side as (bufferBaseAddress + bufferPosition) to get the pointer to your data - so you can do exactly as SWP says, effectively allowing you to pass a pointer to one piece of data that is contained within a larger buffer.

As far as I’m aware, anyway!

(Edit: better wordage)