Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
Tucano::BufferObject< T > Class Template Reference

A buffer object (i.e. ShaderStorageBuffer). More...

#include <bufferobject.hpp>

Public Member Functions

 BufferObject (int s, GLenum buftype)
 
virtual ~BufferObject (void)
 Default Destructor. More...
 
GLuint getBufferID (void)
 Returns The id of the buffer (handle). More...
 
virtual void bind (void)
 Binds buffer object. More...
 
void bindBase (int index)
 Binds buffer to a specific binding point. More...
 
void unbindBase (void)
 Unbinds buffer from binding point. More...
 
virtual void unbind (void)
 Unbinds the buffer object. More...
 
virtual void clear (void)
 Clears all values (sets to zero). More...
 
virtual void readBuffer (T **return_values)
 Reads a GPU buffer and stores it in a CPU array. More...
 
void printBuffer (void)
 Prints the content of a GPU. Usually used for debugging. More...
 
int getSize (void)
 Returns the size of the buffer, number of elements. More...
 

Protected Member Functions

virtual void create (void)
 Creates the Buffer Object. More...
 

Protected Attributes

GLuint buffer_id
 The handle of the Buffer Object. More...
 
GLenum buffer_type
 Type of buffer. More...
 
int size
 Buffer dimension (number of elements). More...
 
int binding_point
 Binding point for this buffer. More...
 

Detailed Description

template<class T>
class Tucano::BufferObject< T >

A buffer object (i.e. ShaderStorageBuffer).

The Buffer Object class is responsible for buffer generation and storage. A BO can be of many types: atomic, storage, transform feedback etc ..

Constructor & Destructor Documentation

template<class T>
Tucano::BufferObject< T >::BufferObject ( int  s,
GLenum  buftype 
)
inline

Buffer Object constructor.

Parameters
sSize of buffer
buftypeType of buffer object.
template<class T>
virtual Tucano::BufferObject< T >::~BufferObject ( void  )
inlinevirtual

Default Destructor.

Member Function Documentation

template<class T>
virtual void Tucano::BufferObject< T >::bind ( void  )
inlinevirtual

Binds buffer object.

template<class T>
void Tucano::BufferObject< T >::bindBase ( int  index)
inline

Binds buffer to a specific binding point.

Parameters
indexBinding point.
template<class T>
virtual void Tucano::BufferObject< T >::clear ( void  )
inlinevirtual

Clears all values (sets to zero).

template<class T>
virtual void Tucano::BufferObject< T >::create ( void  )
inlineprotectedvirtual

Creates the Buffer Object.

template<class T>
GLuint Tucano::BufferObject< T >::getBufferID ( void  )
inline

Returns The id of the buffer (handle).

Returns
ID of the buffer
template<class T>
int Tucano::BufferObject< T >::getSize ( void  )
inline

Returns the size of the buffer, number of elements.

Returns
The size of the storage buffer
template<class T>
void Tucano::BufferObject< T >::printBuffer ( void  )
inline

Prints the content of a GPU. Usually used for debugging.

template<class T>
virtual void Tucano::BufferObject< T >::readBuffer ( T **  return_values)
inlinevirtual

Reads a GPU buffer and stores it in a CPU array.

Assumes each element is of Template Type T.

Parameters
return_valuesPointer to array of values.
template<class T>
virtual void Tucano::BufferObject< T >::unbind ( void  )
inlinevirtual

Unbinds the buffer object.

template<class T>
void Tucano::BufferObject< T >::unbindBase ( void  )
inline

Unbinds buffer from binding point.

Member Data Documentation

template<class T>
int Tucano::BufferObject< T >::binding_point
protected

Binding point for this buffer.

template<class T>
GLuint Tucano::BufferObject< T >::buffer_id
protected

The handle of the Buffer Object.

template<class T>
GLenum Tucano::BufferObject< T >::buffer_type
protected

Type of buffer.

template<class T>
int Tucano::BufferObject< T >::size
protected

Buffer dimension (number of elements).


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