Unofficial OpenGL Software Development Kit 0.5.0
A class for streaming vertex data to buffer objects on the GPU.
This class is specifically used for efficiently streaming vertex data to the GPU. It can map some part of the buffer, invalidate the buffer, and so forth. It also stores a convenient vertex array object, if VAO's are available.
The StreamBuffer has the concept of a current position within the buffer. Each time the buffer is finished being mapped, the current position is advanced by the space that was mapped; the assumption being that you have written to all of the data requested. The user can ask how much space is left in the StreamBuffer.
This method of streaming is one of the documented ones from the OpenGL wiki. This class can be used just as well for uniform buffers or other cases when streaming from the CPU to buffer objects.
Invalidating the buffer resets the current position.
StreamBuffer cannot be copied, as performing a deep-copy would not be a reasonably fast operation.
|A RAII-style class for mapping a StreamBuffer. More...|
|StreamBuffer (size_t bufferSize)|
|Creates a StreamBuffer with the given size. The size cannot be changed later. More...|
|Destroys the stream buffer and the buffer object it stores. |
|Retrieve a communal VAO. If VAO is not defined, returns 0. |
|Retrieve the buffer object. More...|
|size_t||GetBufferPosition () const|
|Gets the current position within the buffer object. |
|size_t||GetSpaceRemaining () const|
|Return how much room there is between the current position and the end of the buffer. |
|size_t||GetTotalBufferSize () const|
|Retrieves the total size of the buffer. |
|Causes all data in the buffer to be lost; the current position is reset to 0. More...|
Creates a StreamBuffer with the given size. The size cannot be changed later.
When this function completes, the buffer bound to
GL_ARRAY_BUFFER will be reset 0.
Retrieve the buffer object.
Causes all data in the buffer to be lost; the current position is reset to 0.
When this function completes, the binding state of GL_ARRAY_BUFFER will be 0.
|StoreAlreadyMapped||Thrown if the StreamBuffer is already mapped.|