| GL Studio C++ Runtime API

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GlsQuadListVCT_2D::TextureGroup Class Reference

`#include <gls_quad_storage.h>`

Inheritance diagram for GlsQuadListVCT_2D::TextureGroup:

## Public Member Functions
| TextureGroup ()
virtual | ~TextureGroup ()
void | SetTexture (IFontImage *texture)
IFontImage * | GetTexture ()
void | StartBuilding ()
void | Bake (IGlsStateManager *stateManager)
void | AddQuad2D (const float x1, const float y1, const float x2, const float y2, const V2f tex[], const glsColor &color)
void | Draw (IGlsStateManager *stateManager, const bool enableColor, const bool enableTexture)

## Protected Member Functions
void | AllocateNextQuad ()
| Called by AddQuad methods to internally allocate the next quad.

## Protected Attributes
unsigned int | _numQuads
DynamicArray< V2f_T2f_C4ub, true > | _vertData
DynamicArray< GLushort, true > | _indices
IFontImage * | _texture
unsigned int | _vboHandle
unsigned int | _indexBufferHandle
unsigned int | _vboBufferSize

## Detailed Description

The TextureGroup class. Holds a number of textured quads.

## Constructor & Destructor Documentation

## ◆ TextureGroup()

TextureGroup | ( |  | ) |

Default constructor

## ◆ ~TextureGroup()

virtual ~TextureGroup | ( |  | ) |
| virtual

Destructor

## Member Function Documentation

## ◆ AddQuad2D()

void AddQuad2D | ( | const float | x1,
|  | const float | y1,
|  | const float | x2,
|  | const float | y2,
|  | const V2f | tex[],
|  | const glsColor & | color
| ) |  |

Add a quad defined by a 2D rectangle from x1,y1 to x2,y2

Parameters

  x1 | X coord of point 1
  y1 | Y coord of point 1
  x2 | X coord of point 2
  y2 | Y coord of point 2
  tex | texture coordinates
  color | color of the quad points

## ◆ Bake()

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

Bakes the quad list, creating VBOs within the GL context. The VBOs created by Bake are used when the object is later drawn with Draw

Parameters

  stateManager | The StateManager object to create the VBOs within

## ◆ Draw()

void Draw | ( | IGlsStateManager * | stateManager,
|  | const bool | enableColor,
|  | const bool | enableTexture
| ) |  |

Draws this quad list

Parameters

  stateManager | OpenGL context to draw list in
  enableColor | Whether or not to use the per vertex colors when drawing
  enableTexture | Whether or not to use the texture when drawing

## ◆ GetTexture()

IFontImage * GetTexture | ( |  | ) |

Get the current texture. This texture will be used when drawing the quad list (if not NULL)

Returns
  The texture to set, NULL for no texture

## ◆ SetTexture()

void SetTexture | ( | IFontImage * | texture | ) |

Set the current texture. This texture will be used when drawing the quad list (if not NULL)

Parameters

  texture | The texture to set, NULL for no texture

## ◆ StartBuilding()

void StartBuilding | ( |  | ) |

Put the quad list in list building mode. Process for using this quad list:

1. Build the list
2. Bake the list (creates VBOs)
3. Draw the list

## Member Data Documentation

## ◆ _indexBufferHandle

unsigned int _indexBufferHandle
| protected

Index buffer Handle for this quad storage

## ◆ _indices

DynamicArray<GLushort, true> _indices
| protected

Indices for the quad list

## ◆ _numQuads

unsigned int _numQuads
| protected

Number of quads in the list

## ◆ _texture

IFontImage* _texture
| protected

Texture to use when drawing quad storage. NULL if untextured

## ◆ _vboBufferSize

unsigned int _vboBufferSize
| protected

Size of the VBO buffer. Cached to so that when a quad is cleared and reset we will only reallocate the VBO when its size changes.

## ◆ _vboHandle

unsigned int _vboHandle
| protected

VBO Handle for this quad storage

## ◆ _vertData

DynamicArray<V2f_T2f_C4ub, true> _vertData
| protected

Vertices for the quad list

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

- gls_quad_storage.h