GL Studio C++ Runtime API
GlsQuadListVCT_2D Class Reference

#include <gls_quad_storage.h>

Inheritance diagram for GlsQuadListVCT_2D:
NonCopyable

Classes

class  TextureGroup
 

Public Member Functions

 GlsQuadListVCT_2D ()
 
virtual ~GlsQuadListVCT_2D ()
 
void SetTexCoords (const float x1, const float y1, const float x2, const float y2)
 
void SetTexture (IFontImage *image)
 
void SetColor (const glsColor &color)
 
void StartBuilding ()
 
void Bake (IGlsStateManager *stateManager)
 
void AddQuad2D (const float x1, const float y1, const float x2, const float y2)
 
void Draw (IGlsStateManager *stateManager, const bool enableColor, const bool enableTexture)
 
unsigned int NumQuads ()
 

Static Public Attributes

static const GLuint VERT_SIZE = sizeof( V2f )
 
static const GLuint VERT_OFFSET = 0
 

Protected Attributes

DynamicArray< TextureGroup *, false > _textureGroups
 
unsigned int _numTextureGroups
 
unsigned int _numQuads
 
V2f _currentTex [4]
 
glsColor _currentColor
 

Detailed Description

Constructor & Destructor Documentation

Default constructor

virtual ~GlsQuadListVCT_2D ( )
virtual

Destructor

Member Function Documentation

void AddQuad2D ( const float  x1,
const float  y1,
const float  x2,
const float  y2 
)

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

Parameters
x1X coord of point 1
y1Y coord of point 1
x2X coord of point 2
y2Y coord of point 2
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
stateManagerThe StateManager object to create the VBOs within
void Draw ( IGlsStateManager stateManager,
const bool  enableColor,
const bool  enableTexture 
)

Draws this quad list

Parameters
stateManagerOpenGL context to draw list in
enableColorWhether or not to use the per vertex colors when drawing
enableTextureWhether or not to use the texture when drawing
unsigned int NumQuads ( )
inline
Returns
Returns the number of quads in the list
void SetColor ( const glsColor color)

Set the current drawing color. When a quad is added, its vertex colors are set to the current color

Parameters
colorThe color to set
void SetTexCoords ( const float  x1,
const float  y1,
const float  x2,
const float  y2 
)

Set the current texture coordinates. When a quad is added, these texture coordinates will be used. x1,y1 will map to quad vertex[0] and x2,y2 will map to quad vertex[1]

Parameters
x1X coord of point 1
y1Y coord of point 1
x2X coord of point 2
y2Y coord of point 2
void SetTexture ( IFontImage image)

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

Parameters
imageThe texture to set, NULL for no texture
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

glsColor _currentColor
protected

Last color that was set. Used only while building a list

V2f _currentTex[4]
protected

Current texture coordinates supplied for current quad (Texture coordinates are not required to change per quad). Used only while building list.

unsigned int _numQuads
protected

Pointer to the current texture group that quads will be added to with the next call to AddQuad Number of quads in the list (total)

unsigned int _numTextureGroups
protected

The number of textured quad groups in the list.

DynamicArray<TextureGroup*, false> _textureGroups
protected

The list of all textured quad groups.

const GLuint VERT_OFFSET = 0
static

Constant offsets to the primitive vertex attributes.

const GLuint VERT_SIZE = sizeof( V2f )
static

Constant sizes of the primitive vertex attributes


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