class mrpt::opengl::COpenGLBuffer

A wrapper for an OpenGL buffer object.

Refer to docs for glGenBuffers() and glBufferData().

#include <mrpt/opengl/COpenGLBuffer.h>

class COpenGLBuffer
{
public:
    // enums

    enum Type;
    enum Usage;

    // structs

    struct RAII_Impl;

    // construction

    COpenGLBuffer(const Type type);
    COpenGLBuffer();

    //
methods

    Type type() const;
    Usage usage() const;
    void setUsage(const Usage u);
    void create();
    void createOnce();
    bool isCreated() const;
    void destroy();
    void bind();
    void release();
    unsigned int bufferId() const;
    void allocate(const void* data, int byteCount);
};

Methods

void create()

Actually create the buffer, destroying any previously existing buffer.

Call after setting the type and usage.

See also:

allocate()

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.