Class Avogadro::Rendering::BufferObject#

class Avogadro::Rendering::BufferObject#

Buffer object to store geometry/attribute data on the GPU.

This class creates GPU buffer object, and uploads the data to the GPU.

Author

Marcus D. Hanwell

Public Types

enum ObjectType#

Values:

enumerator ArrayBuffer#
enumerator ElementArrayBuffer#

Public Functions

BufferObject(ObjectType type = ArrayBuffer)#
~BufferObject()#
ObjectType type() const#

Get the type of the buffer object.

Index handle() const#

Get the handle of the buffer object.

inline bool ready() const#

Determine if the buffer object is ready to be used.

template<class ContainerT>
inline bool upload(const ContainerT &array, ObjectType type)#

Upload data to the buffer object. The BufferObject::type() must match type or be uninitialized.

The ContainerT type must have tightly packed values of ContainerT::value_type accessible by reference via ContainerT::operator[]. Additionally, the standard size() and empty() methods must be implemented. The std::vector and Avogadro::Core::Array classes are examples of such supported containers.

bool bind()#

Bind the buffer object ready for rendering.

Note

Only one ARRAY_BUFFER and one ELEMENT_ARRAY_BUFFER may be bound at any time.

bool release()#

Release the buffer. This should be done after rendering is complete.

inline std::string error() const#

Return a string describing errors.