Class Buffer

Nested Relationships

Nested Types

Class Documentation

class Buffer

A wrapper for an OpenGL buffer object (eg Vertex Buffer Object or VBO) Refer to docs for glGenBuffers() and glBufferData().

See also

FrameBuffer

Note

OpenGL Buffer Objects can be shared among threads.

Public Types

enum class Type : uint16_t

Values:

enumerator Vertex
enumerator ElementIndex
enumerator PixelPack
enumerator PixelUnpack
enum class Usage : uint16_t

Values:

enumerator StreamDraw
enumerator StreamRead
enumerator StreamCopy
enumerator StaticDraw
enumerator StaticRead
enumerator StaticCopy
enumerator DynamicDraw
enumerator DynamicRead
enumerator DynamicCopy

Public Functions

explicit Buffer(Type type)
inline Buffer()
~Buffer() = default
inline Type type() const
inline Usage usage() const
inline void setUsage(const Usage u)
inline void createOnce()

Calls create() only if the buffer has not been created yet.

inline bool initialized() const
inline void destroy()

Automatically called upon destructor, no need for the user to call it in normal situations.

inline void bind()
inline void unbind()
inline unsigned int bufferId() const
inline 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.