Allocate a new Buffer to hold the given data.
Mark the Buffer as dirty, such that the next call to sync() will upload the data to the GPU memory.
If the Buffer is marked as dirty, uploads the data from the T[] (CPU/us) to the Vbo!T (GPU/OpenGL). Resets is_dirty.
Download the data form the Vbo!T (GPU/OpenGL) to the T[] (CPU/us).
Check if the Buffer is marked as dirty. (i.e. sync() would do anything.)
The Vbo!T holding the GPU's (OpenGL's) copy of the data.
The T[] containing the CPU's (our) copy of the data.
If the Buffer is marked as dirty, uploads the data from the T[] (CPU/us) to the Vbo!T (GPU/OpenGL). Resets is_dirty.
The GenericVbo holding the GPU's (OpenGL's) copy of the data.
Manages a OpenGL vertex buffer object (Vbo).
Contains both a Vbo!T object and a T[], which it can keep in sync.
Basically, a Vbo!T has data stored in the GPU memory (for OpenGL), while the T[] has data stored in the CPU memory (for us). If you modify the T[] and want the changes to be reflected on the GPU, call markDirty(). Then, the next call to sync() will (re)upload the data to the GPU. If you don't want to keep a copy of the data in the CPU memory, just empty the T[] and don't call markDirty(). syncBack() can be used to download the data again from the GPU into the CPU memory.
Note that a Vbo!T is only allocated on the GPU (in OpenGL) the first time it is used. So until the first time sync() uploads the data, there is nothing allocated in OpenGL, not even an empty Vbo. (Unless vbo.create() is called explicitly, of course.)