clan::UniformBuffer Class Reference

Uniform Buffer. More...

#include <uniform_buffer.h>

+ Inheritance diagram for clan::UniformBuffer:

Public Member Functions

 UniformBuffer ()
 Constructs a null instance. More...
 
 UniformBuffer (GraphicContext &gc, int block_size, BufferUsage usage=usage_dynamic_draw)
 Constructs a ProgramUniformBlock. More...
 
 UniformBuffer (GraphicContext &gc, const void *data, int size, BufferUsage usage=usage_dynamic_draw)
 Constructs a VertexArrayBuffer. More...
 
 UniformBuffer (GraphicContext &gc, ProgramObject &program, const std::string &name, int num_blocks=1, BufferUsage usage=usage_dynamic_draw)
 Constructs a ProgramUniformBlock - convenience function. More...
 
void copy_from (GraphicContext &gc, TransferBuffer &buffer, int dest_pos=0, int src_pos=0, int size=-1)
 Copies data from transfer buffer. More...
 
void copy_to (GraphicContext &gc, TransferBuffer &buffer, int dest_pos=0, int src_pos=0, int size=-1)
 Copies data to transfer buffer. More...
 
UniformBufferProviderget_provider () const
 Get Provider. More...
 
bool is_null () const
 Returns true if this object is invalid. More...
 
 operator bool () const
 
bool operator== (const UniformBuffer &other) const
 Handle comparison operator. More...
 
void throw_if_null () const
 Throw an exception if this object is invalid. More...
 
void upload_data (GraphicContext &gc, const void *data, int size)
 Uploads data to uniforms buffer. More...
 

Detailed Description

Uniform Buffer.

Constructor & Destructor Documentation

clan::UniformBuffer::UniformBuffer ( )

Constructs a null instance.

clan::UniformBuffer::UniformBuffer ( GraphicContext gc,
int  block_size,
BufferUsage  usage = usage_dynamic_draw 
)

Constructs a ProgramUniformBlock.

Parameters
gc= Graphic Context
size= size - use ProgramObject::get_uniform_buffer_size() to calcuate this
usage= Buffer Usage
clan::UniformBuffer::UniformBuffer ( GraphicContext gc,
const void *  data,
int  size,
BufferUsage  usage = usage_dynamic_draw 
)

Constructs a VertexArrayBuffer.

Parameters
gc= Graphic Context
data= void
size= value
usage= Buffer Usage
clan::UniformBuffer::UniformBuffer ( GraphicContext gc,
ProgramObject program,
const std::string name,
int  num_blocks = 1,
BufferUsage  usage = usage_dynamic_draw 
)

Constructs a ProgramUniformBlock - convenience function.

Parameters
gc= Graphic Context
num_blocks= Number of blocks to allocate
usage= Buffer Usage

Member Function Documentation

void clan::UniformBuffer::copy_from ( GraphicContext gc,
TransferBuffer buffer,
int  dest_pos = 0,
int  src_pos = 0,
int  size = -1 
)

Copies data from transfer buffer.

Referenced by clan::UniformVector< Type >::copy_from().

void clan::UniformBuffer::copy_to ( GraphicContext gc,
TransferBuffer buffer,
int  dest_pos = 0,
int  src_pos = 0,
int  size = -1 
)

Copies data to transfer buffer.

Referenced by clan::UniformVector< Type >::copy_to().

UniformBufferProvider* clan::UniformBuffer::get_provider ( ) const

Get Provider.

Returns
provider
bool clan::UniformBuffer::is_null ( ) const
inline

Returns true if this object is invalid.

clan::UniformBuffer::operator bool ( ) const
inlineexplicit
bool clan::UniformBuffer::operator== ( const UniformBuffer other) const

Handle comparison operator.

void clan::UniformBuffer::throw_if_null ( ) const

Throw an exception if this object is invalid.

void clan::UniformBuffer::upload_data ( GraphicContext gc,
const void *  data,
int  size 
)

Uploads data to uniforms buffer.

The size specified must match the size of the buffer and is only included to help guard against buffer overruns.

Referenced by clan::UniformVector< Type >::upload_data().


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