| GL Studio C++ Runtime API

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GlsIndexArray Class Reference

`#include <gls_index_array.h>`

Inheritance diagram for GlsIndexArray:

## Public Member Functions
| GlsIndexArray ()
virtual | ~GlsIndexArray ()
void | SetSize (const unsigned int size)
unsigned int | GetSize () const
void | SetIndices (const unsigned short indexData[])
void | SetIndex (const unsigned int index, const unsigned short value)
void | Bake (IGlsStateManager *stateManager)
void | Bind (IGlsStateManager *stateManager)

## Protected Member Functions
void | AllocateBuffer (const unsigned int size)
void | DeallocateBuffer ()

## Protected Attributes
unsigned short * | _indexData
unsigned int | _vboHandle
unsigned int | _size

## Detailed Description

The GlsIndexArray class. Wraps an OpenGL index buffer object.

## Constructor & Destructor Documentation

## ◆ GlsIndexArray()

GlsIndexArray | ( |  | ) |

Default constructor

## ◆ ~GlsIndexArray()

virtual ~GlsIndexArray | ( |  | ) |
| virtual

Destructor

## Member Function Documentation

## ◆ AllocateBuffer()

void AllocateBuffer | ( | const unsigned int | size | ) |
| protected

Allocates the buffer data, copying the existing data

Parameters

  size | The new size in bytes to allocate

## ◆ Bake()

void Bake | ( | IGlsStateManager * | stateManager | ) |

Download the index buffer data to Open GL

Precondition
  (_vboHandle != 0) && (_size > 0)

Parameters

  stateManager | The OpenGL state to download the index buffer to

## ◆ Bind()

void Bind | ( | IGlsStateManager * | stateManager | ) |

Bind the index buffer, e.g. make it current

Precondition
  (_vboHandle != 0) && (_size > 0)

Parameters

  stateManager | The OpenGL state to bind the buffer on

## ◆ DeallocateBuffer()

void DeallocateBuffer | ( |  | ) |
| protected

Deallocates the buffer data

## ◆ GetSize()

unsigned int GetSize | ( |  | ) | const
| inline

Returns
  Returns the size of the index buffer

## ◆ SetIndex()

void SetIndex | ( | const unsigned int | index,
|  | const unsigned short | value
| ) |  |

Sets one index

Precondition
  index < _size

Parameters

  index | The index of the index to set
  value | The index data

## ◆ SetIndices()

void SetIndices | ( | const unsigned short | indexData[] | ) |

Populates the the index buffer

Precondition
  _size > 0

Parameters

  indexData | The indices to set. The array length is assumed to be equal to GetSize()

## ◆ SetSize()

void SetSize | ( | const unsigned int | size | ) |

Sets the size of the index buffer

Parameters

  size | New index buffer count

## Member Data Documentation

## ◆ _indexData

unsigned short* _indexData
| protected

The memory for storing the indices

## ◆ _size

unsigned int _size
| protected

The number of indices. There can be unsigned int quantity of unsigned short values

## ◆ _vboHandle

unsigned int _vboHandle
| protected

The OpenGL VBO handle

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

- gls_index_array.h