UGDK
0.5.0
|
#include <ugdk/graphic/opengl/vertexbuffer.h>
Public Member Functions | |
VBO (size_t size, GLenum target, GLenum usage) | |
virtual | ~VBO () |
virtual void * | map () |
virtual void | unmap () |
virtual void | bind () const |
virtual void | unbind () const |
virtual void | fill (size_t offset, size_t size, const void *data) |
virtual const void * | getPointer (size_t offset) const |
bool | loadVolatile () |
void | unloadVolatile () |
![]() | |
VertexBuffer (size_t size, GLenum target, GLenum usage) | |
virtual | ~VertexBuffer () |
size_t | getSize () const |
GLenum | getTarget () const |
GLenum | getUsage () const |
Additional Inherited Members | |
![]() | |
static VertexBuffer * | Create (size_t size, GLenum target, GLenum usage) |
static std::shared_ptr< const VertexBuffer > | CreateDefaultShared () |
static const VertexBuffer * | CreateDefault () |
Vertex Buffer Object (VBO) implementation of VertexBuffer.
This will be used on all systems that support it. It's in general faster than vertex arrays, but especially in use-cases where there is no need to update the data every frame.
ugdk::graphic::opengl::VBO::VBO | ( | size_t | size, |
GLenum | target, | ||
GLenum | usage | ||
) |
Constructor.
size | The size of the VertexBuffer in bytes. |
target | The target VertexBuffer object, e.g. GL_ARRAY_BUFFER. |
usage | Usage hint, e.g. GL_DYNAMIC_DRAW. |
|
virtual |
Deletes the VBOs from OpenGL.
|
virtual |
Bind the VertexBuffer to the specified target. (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER).
target | GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER. |
Implements ugdk::graphic::opengl::VertexBuffer.
|
virtual |
Fill a portion of the buffer with data.
The VertexBuffer must be bound to use this function.
offset | The offset in the VertexBuffer to store the data. |
size | The size of the incoming data. |
data | Pointer to memory to copy data from. |
Implements ugdk::graphic::opengl::VertexBuffer.
|
virtual |
Get a pointer which represents the specified byte offset.
offset | The byte offset. (0 is first byte). |
Implements ugdk::graphic::opengl::VertexBuffer.
bool ugdk::graphic::opengl::VBO::loadVolatile | ( | ) |
|
virtual |
Map the VertexBuffer to client memory.
This can be faster for large changes to the buffer. For smaller changes, see fill().
The VertexBuffer must be bound to use this function.
Implements ugdk::graphic::opengl::VertexBuffer.
|
virtual |
Unbind a prevously bound VertexBuffer.
Implements ugdk::graphic::opengl::VertexBuffer.
void ugdk::graphic::opengl::VBO::unloadVolatile | ( | ) |
|
virtual |
Unmap a previously mapped VertexBuffer. The buffer must be unmapped when used to draw elements.
The VertexBuffer must be bound to use this function.
Implements ugdk::graphic::opengl::VertexBuffer.