class mrpt::opengl::Buffer
Overview
A wrapper for an OpenGL buffer object (eg Vertex Buffer Object or VBO) Refer to docs for glGenBuffers() and glBufferData().
OpenGL Buffer Objects can be shared among threads.
See also:
#include <mrpt/opengl/Buffer.h> class Buffer { public: // enums enum Type; enum Usage; // structs struct RAII_Impl; // construction Buffer(const Type type); Buffer(); // methods Type type() const; Usage usage() const; void setUsage(const Usage u); void createOnce(); bool initialized() const; void destroy(); void bind(); void unbind(); unsigned int bufferId() const; void allocate(const void* data, int byteCount); };
Methods
void createOnce()
Calls create() only if the buffer has not been created yet.
void destroy()
Automatically called upon destructor, no need for the user to call it in normal situations.
void allocate(const void* data, int byteCount)
Reserves byteCount bytes in the buffer and copy to it the provided data.
create() and bind() must be called before using this method.