![]() |
VR-Forces 4.8 Class Documentation
|
A generic OpenGL buffer. More...

Public Member Functions | |
| DtGlBuffer (const char *name, DtBufferType type, DtUsage usage, DtCpuAccess accessType, bool hasStagingBuffer) | |
| CTOR. More... | |
| virtual | ~DtGlBuffer () |
| DTOR. More... | |
| virtual void | tearDown (void) |
| releases GL objects and delete GL buffer More... | |
| unsigned int | releaseHandle (void) |
| releases GL handle but does not delete GL buffer More... | |
| virtual bool | updateBuffer (const int sizeToTransferInBytes, const void *data) |
| update the buffer, this can resize it if needed or create it from scratch More... | |
| virtual void | clearBuffer (unsigned int clearValue) |
| clear the buffer to the value specified. More... | |
| virtual bool | bufferSubData (unsigned int offset, unsigned int sizeInBytes, const void *data) |
| Optional API to upload data directly to the buffer, side stepping the staging buffer. More... | |
| virtual void | resetStagingBuffer () |
| set the whole staging buffer to 0 More... | |
| virtual int | sizeInBytes (void) const |
| The size in bytes of the buffer. More... | |
| virtual const unsigned int | handle (void) const |
| The internal GL handle of the buffer. More... | |
| virtual void | setResizeMultiplier (float rmul) |
| multiplier on how much extra memory should get allocated at gl buffer creation time. More... | |
| virtual void | setUseIncrementalUpdate (bool incrementalUpdate) |
| enable or disable incremental update for this buffer this means that only new data is sent down instead of resending the whole buffer every time. More... | |
| virtual bool | useIncrementalUpdate () |
| get the current state of incremental update for this buffer. More... | |
| virtual float | resizeMultiplier () |
| returns multiplier on how much extra memory should get allocated at gl buffer creation time. More... | |
| unsigned int | type (void) const |
| The internal OpenGL type of the buffer of the gl buffer. More... | |
| virtual void | bind () |
| bind/unbind the buffer bind will not create the buffer if it is not yet created. More... | |
| virtual void | unbind () |
| virtual unsigned char * | stagingBuffer (void) const |
| Internally GLBuffer uses a 'staging buffer' This is because map/unmap and directly uploading to the buffer is horribly slow in OpenGL. More... | |
| virtual unsigned char * | stagingBufferWithSize (unsigned int requestedSizeInBytes) |
| gets the staging buffer can resize the opengl data. More... | |
| virtual void | syncStagingBufferToGpu (unsigned int offset, unsigned int sizeInBytes) |
| Use when you modified (and hence need to update) only part of the buffer [offset, offset+sizeInBytes]. More... | |
| virtual void | syncStagingBufferToGpu () |
| Use when you modified (and hence need to update) the whole buffer [0, sizeInBytes()]. More... | |
Protected Member Functions | |
| virtual bool | createAndBindBuffer () |
| creates buffer, must be called in main render thread. More... | |
| virtual int | calculateNewSize (int requestedNewSizeInBytes) |
| helper function to calculate the new size a buffer should be based on it's current size and the requested size. More... | |
Protected Attributes | |
| std::string | myName |
| unsigned int | myHandle |
| unsigned int | myType |
| int | mySizeInBytes |
| float | myResizeMultiplier |
| unsigned char * | myStagingBuffer |
| bool | myHasStagingBuffer |
| DtUsage | myUsage |
| DtCpuAccess | myAccessType |
| bool | myUseIncrementalUpdate |
| int | myLastBufferTransferOffset |
Private Member Functions | |
| DtGlBuffer (const DtGlBuffer &other) | |
| Copy Constructor not implemented – Copy Not Allowed. More... | |
| DtGlBuffer & | operator= (const DtGlBuffer &other) |
| Assignment Operator Not implemented – Assignment Not Allowed. More... | |
A generic OpenGL buffer.
This can be: -> a vertex buffer -> an index buffer -> a shader storage buffer (SSBO), etc
| makVrv::DtGlBuffer::DtGlBuffer | ( | const char * | name, |
| DtBufferType | type, | ||
| DtUsage | usage, | ||
| DtCpuAccess | accessType, | ||
| bool | hasStagingBuffer | ||
| ) |
CTOR.
| name | Name of buffer for debugging and nsight. |
| type | Indicates the type of the buffer this will be (vertex buffer, index buffer, etc) |
| usage | Indicates what the intended usage of this buffer will be (dynamic, const, etc) |
| accessType | Indicates what level of CPU access is needed (will CPU only ever write, etc) |
| hasStagingBuffer | indicates whether this buffer will have an internal staging buffer |
|
virtual |
DTOR.
|
private |
Copy Constructor not implemented – Copy Not Allowed.
|
private |
Assignment Operator Not implemented – Assignment Not Allowed.
|
virtual |
releases GL objects and delete GL buffer
releases GL handle but does not delete GL buffer
|
virtual |
update the buffer, this can resize it if needed or create it from scratch
| sizeInBytes | Requested size in bytes |
| data | is the data to copy in. |
clear the buffer to the value specified.
clears both the GPU data and the staging buffer if there is a staging buffer. requires valid graphics context
|
virtual |
bind/unbind the buffer bind will not create the buffer if it is not yet created.
it will also spew a warning so it is easy to know when it is used incorrectly.
|
virtual |
Internally GLBuffer uses a 'staging buffer' This is because map/unmap and directly uploading to the buffer is horribly slow in OpenGL.
The usage therefore is to get the staging buffer, modify it and then call syncStagingBufferToGpu
|
virtual |
gets the staging buffer can resize the opengl data.
FIXME seperate sb size from ogl
|
virtual |
Use when you modified (and hence need to update) only part of the buffer [offset, offset+sizeInBytes].
|
virtual |
Use when you modified (and hence need to update) the whole buffer [0, sizeInBytes()].
|
virtual |
Optional API to upload data directly to the buffer, side stepping the staging buffer.
You can use one or the other. That is to say you cannot use this API if you specified that this buffer has a staging buffer, which means you'll use that API (getStagingBuffer, syncToGPU)
|
virtual |
set the whole staging buffer to 0
|
virtual |
The size in bytes of the buffer.
The internal GL handle of the buffer.
|
virtual |
multiplier on how much extra memory should get allocated at gl buffer creation time.
|
virtual |
enable or disable incremental update for this buffer this means that only new data is sent down instead of resending the whole buffer every time.
On resize all the data is sent down again. use this if the data is static
|
virtual |
get the current state of incremental update for this buffer.
|
virtual |
returns multiplier on how much extra memory should get allocated at gl buffer creation time.
The internal OpenGL type of the buffer of the gl buffer.
|
protectedvirtual |
creates buffer, must be called in main render thread.
returns true if the buffer was created
helper function to calculate the new size a buffer should be based on it's current size and the requested size.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |