UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ugdk::graphic::opengl::VBO Class Reference

#include <ugdk/graphic/opengl/vertexbuffer.h>

Inheritance diagram for ugdk::graphic::opengl::VBO:
Collaboration diagram for ugdk::graphic::opengl::VBO:

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 ()
 
- Public Member Functions inherited from ugdk::graphic::opengl::VertexBuffer
 VertexBuffer (size_t size, GLenum target, GLenum usage)
 
virtual ~VertexBuffer ()
 
size_t getSize () const
 
GLenum getTarget () const
 
GLenum getUsage () const
 

Additional Inherited Members

- Static Public Member Functions inherited from ugdk::graphic::opengl::VertexBuffer
static VertexBufferCreate (size_t size, GLenum target, GLenum usage)
 
static std::shared_ptr< const
VertexBuffer
CreateDefaultShared ()
 
static const VertexBufferCreateDefault ()
 

Detailed Description

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.

Constructor & Destructor Documentation

ugdk::graphic::opengl::VBO::VBO ( size_t  size,
GLenum  target,
GLenum  usage 
)

Constructor.

Parameters
sizeThe size of the VertexBuffer in bytes.
targetThe target VertexBuffer object, e.g. GL_ARRAY_BUFFER.
usageUsage hint, e.g. GL_DYNAMIC_DRAW.
virtual ugdk::graphic::opengl::VBO::~VBO ( )
virtual

Deletes the VBOs from OpenGL.

Member Function Documentation

virtual void ugdk::graphic::opengl::VBO::bind ( ) const
virtual

Bind the VertexBuffer to the specified target. (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER).

Parameters
targetGL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.

Implements ugdk::graphic::opengl::VertexBuffer.

virtual void ugdk::graphic::opengl::VBO::fill ( size_t  offset,
size_t  size,
const void *  data 
)
virtual

Fill a portion of the buffer with data.

The VertexBuffer must be bound to use this function.

Parameters
offsetThe offset in the VertexBuffer to store the data.
sizeThe size of the incoming data.
dataPointer to memory to copy data from.

Implements ugdk::graphic::opengl::VertexBuffer.

virtual const void* ugdk::graphic::opengl::VBO::getPointer ( size_t  offset) const
virtual

Get a pointer which represents the specified byte offset.

Parameters
offsetThe byte offset. (0 is first byte).
Returns
A pointer which represents the offset.

Implements ugdk::graphic::opengl::VertexBuffer.

bool ugdk::graphic::opengl::VBO::loadVolatile ( )
virtual void* ugdk::graphic::opengl::VBO::map ( )
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.

Returns
A pointer to memory which represents the buffer.

Implements ugdk::graphic::opengl::VertexBuffer.

virtual void ugdk::graphic::opengl::VBO::unbind ( ) const
virtual

Unbind a prevously bound VertexBuffer.

Implements ugdk::graphic::opengl::VertexBuffer.

void ugdk::graphic::opengl::VBO::unloadVolatile ( )
virtual void ugdk::graphic::opengl::VBO::unmap ( )
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.


The documentation for this class was generated from the following file: