GL Studio C++ Runtime API
GlsQuadListVC_3D Class Reference

#include <gls_quad_storage.h>

Inheritance diagram for GlsQuadListVC_3D:
NonCopyable

Public Member Functions

 GlsQuadListVC_3D ()
 
virtual ~GlsQuadListVC_3D ()
 
void AddQuad2D (const float x1, const float y1, const float x2, const float y2)
 
void AddQuad3D (const Vector v[])
 
void SetColor (const glsColor &color)
 
void StartBuilding ()
 
void Bake (IGlsStateManager *stateManager)
 
void Draw (IGlsStateManager *stateManager, const bool enableColor)
 
void DrawOutlines (IGlsStateManager *stateManager, const bool enableColor)
 
unsigned int NumQuads ()
 

Static Public Attributes

static const GLuint VERT_SIZE = sizeof( Vector )
 Size of a vertex in bytes.
 
static const GLuint COLOR_SIZE = sizeof( glsColor )
 Size of a color in bytes.
 
static const void *const VERT_OFFSET
 
static const void *const COLOR_OFFSET
 

Protected Member Functions

void AllocateNextQuad ()
 Called by AddQuad methods to internally allocate the next quad.
 
void SetupVBO (IGlsStateManager *stateManager, const bool enableColor)
 

Protected Attributes

unsigned int _numQuads
 
DynamicArray< V3f_C4ub, true > _vertData
 
DynamicArray< GLushort, true > _indices
 
unsigned int _vboHandle
 
unsigned int _indexBufferHandle
 
unsigned int _vboBufferSize
 
glsColor _currentColor
 

Detailed Description

Constructor & Destructor Documentation

◆ GlsQuadListVC_3D()

Default constructor

◆ ~GlsQuadListVC_3D()

virtual ~GlsQuadListVC_3D ( )
virtual

Destructor

Member Function Documentation

◆ AddQuad2D()

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

◆ AddQuad3D()

void AddQuad3D ( const Vector  v[])

Add a 3D quad defined by 4 3D vertices

Parameters
vArray of 4 vertices containing the vertices of the 3D quad

◆ 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
stateManagerThe StateManager object to create the VBOs within

◆ Draw()

void Draw ( IGlsStateManager stateManager,
const bool  enableColor 
)

Draws this quad list

Parameters
stateManagerOpenGL context to draw list in
enableColorWhether or not to use the per vertex colors when drawing

◆ DrawOutlines()

void DrawOutlines ( IGlsStateManager stateManager,
const bool  enableColor 
)

Draws this quad list as a series of line loops

Parameters
stateManagerOpenGL context to draw list in
enableColorWhether or not to use the per vertex colors when drawing

◆ NumQuads()

unsigned int NumQuads ( )
inline
Returns
Returns the number of quads in the list

◆ SetColor()

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

◆ SetupVBO()

void SetupVBO ( IGlsStateManager stateManager,
const bool  enableColor 
)
protected

Bind the quad list's VBOs and prepare for drawing

Parameters
stateManagerOpenGL context to draw list in
enableColorWhether or not to use the per vertex colors when drawing

◆ 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

◆ _currentColor

glsColor _currentColor
protected

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

◆ _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

◆ _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<V3f_C4ub, true> _vertData
protected

Vertices for the quad list

◆ COLOR_OFFSET

const void* const COLOR_OFFSET
static

Constant offsets to the color vertex attribute.

Note
Theoretically should be GLuint, but OpenGL's functions pass integer offsets as pointers.

◆ VERT_OFFSET

const void* const VERT_OFFSET
static

Constant offsets to the primitive vertex attribute.

Note
Theoretically should be GLuint, but OpenGL's functions pass integer offsets as pointers.

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