clan::UniformBuffer Class Reference - ClanLib SDK
Description: clan::UniformBuffer Class Reference

Public Member Functions | List of all members
clan::UniformBuffer Class Reference
clanDisplay Display

Uniform Buffer. More...

`#include <uniform_buffer.h>`

Inheritance diagram for clan::UniformBuffer:

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

## Detailed Description

Uniform Buffer.

## Constructor & Destructor Documentation

## ◆ UniformBuffer() [1/4]

clan::UniformBuffer::UniformBuffer | ( |  | ) |

Constructs a null instance.

Referenced by clan::UniformVector< Type >::UniformVector(), clan::UniformVector< Type >::UniformVector(), clan::UniformVector< Type >::UniformVector(), and operator==().

## ◆ UniformBuffer() [2/4]

clan::UniformBuffer::UniformBuffer | ( | GraphicContext & | gc,
|  | int | block_size,
|  | BufferUsage | usage = BufferUsage::dynamic_draw )

Constructs a ProgramUniformBlock.

Parameters

  gc | = Graphic Context
  size | = size - use ProgramObject::get_uniform_buffer_size() to calcuate this
  usage | = Buffer Usage

References clan::dynamic_draw.

## ◆ UniformBuffer() [3/4]

clan::UniformBuffer::UniformBuffer | ( | GraphicContext & | gc,
|  | const void * | data,
|  | int | size,
|  | BufferUsage | usage = BufferUsage::dynamic_draw )

Constructs a VertexArrayBuffer.

Parameters

  gc | = Graphic Context
  data | = void
  size | = value
  usage | = Buffer Usage

References clan::dynamic_draw.

## ◆ UniformBuffer() [4/4]

clan::UniformBuffer::UniformBuffer | ( | GraphicContext & | gc,
|  | ProgramObject & | program,
|  | const std::string & | name,
|  | int | num_blocks = 1,
|  | BufferUsage | usage = BufferUsage::dynamic_draw )

Constructs a ProgramUniformBlock - convenience function.

Parameters

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

References clan::dynamic_draw.

## Member Function Documentation

## ◆ copy_from()

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().

## ◆ copy_to()

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().

## ◆ get_provider()

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

Get Provider.

Returns
  provider

## ◆ is_null()

bool clan::UniformBuffer::is_null | ( |  | ) | const
| inline

Returns true if this object is invalid.

## ◆ operator bool()

clan::UniformBuffer::operator bool | ( |  | ) | const
| inlineexplicit

## ◆ operator==()

bool clan::UniformBuffer::operator== | ( | const UniformBuffer & | other | ) | const

Handle comparison operator.

References UniformBuffer().

## ◆ throw_if_null()

void clan::UniformBuffer::throw_if_null | ( |  | ) | const

Throw an exception if this object is invalid.

## ◆ upload_data()

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(), and clan::UniformVector< Type >::upload_data().

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

- uniform_buffer.h