Loading...
Searching...
No Matches
BufferObject Class Reference

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

`#include <avogadro/rendering/bufferobject.h>`

## Public Types

enum | ObjectType { ArrayBuffer , ElementArrayBuffer }

## Public Member Functions

| BufferObject (ObjectType type=ArrayBuffer)
ObjectType | type () const
Index | handle () const
bool | ready () const
template<class ContainerT>
bool | upload (const ContainerT &array, ObjectType type)
bool | bind ()
bool | release ()
std::string | error () const

## Detailed Description

Author
  Marcus D. Hanwell

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

## Member Function Documentation

## type()

ObjectType type | ( |  | ) | const

Get the type of the buffer object.

## handle()

Index handle | ( |  | ) | const

Get the handle of the buffer object.

## ready()

bool ready | ( |  | ) | const

Determine if the buffer object is ready to be used.

## upload()

template<class ContainerT>

bool upload | ( | const ContainerT & | array,
|  | BufferObject::ObjectType | objectType )

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.

## bind()

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.

## release()

bool release | ( |  | ) |

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

## error()

std::string error | ( |  | ) | const

Return a string describing errors.

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

- bufferobject.h