GL Studio C++ Runtime API
GlsTriangleStrip2D Class Reference
Inheritance diagram for GlsTriangleStrip2D:
NonCopyable

Public Member Functions

 GlsTriangleStrip2D ()
 
virtual ~GlsTriangleStrip2D ()
 
void StartBuildingStrip ()
 
void SetTexture (Image *image)
 
void SetTexCoords (const float x1, const float y1, const float x2, const float y2, const float x3, const float y3)
 
void AddTriangle2D (const float x1, const float y1, const float x2, const float y2, const float x3, const float y3)
 
void Bake (IGlsStateManager *stateManager)
 
void Draw (IGlsStateManager *stateManager, const bool enableTexture)
 
unsigned int GetNumTriangles ()
 

Static Public Attributes

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

Protected Member Functions

void AllocateNextTriangle ()
 
void Stripify ()
 

Protected Attributes

unsigned int _numTriangles
 
unsigned int _stripSize
 
DynamicArray< V2f_T2f, true > _vertData
 
V2f _currentTex [3]
 
Image_texture
 
unsigned int _vboHandle
 
unsigned int _vboBufferSize
 
bool _stripified
 

Constructor & Destructor Documentation

Default constructor

virtual ~GlsTriangleStrip2D ( )
virtual

Destructor

Member Function Documentation

void AddTriangle2D ( const float  x1,
const float  y1,
const float  x2,
const float  y2,
const float  x3,
const float  y3 
)

Add the next triangle to the strip. Must be connected using previous two vertices of strip or be degenerate

Parameters
x1X coord of vertex 1
y1Y coord of vertex 1
x2X coord of vertex 2
y2Y coord of vertex 2
x3X coord of vertex 3
y3Y coord of vertex 3
Precondition
_stripified == false
Postcondition
_numTriangles++, triangle is added to strip
void AllocateNextTriangle ( )
protected

Allocate the next triangle in the set of ordered, connected triangles

void Bake ( IGlsStateManager stateManager)

Finish building strip and bake it to a VBO

Parameters
stateManagerStateManager object to issue GL commands to
Precondition
_stripified == false
_stripified == true
void Draw ( IGlsStateManager stateManager,
const bool  enableTexture 
)

Draw the triangle strip

Parameters
stateManagerStateManager object to issue GL commands to
enableTextureTrue if strip will be drawn textured
Precondition
_stripified == true
Postcondition
The strip is drawn
unsigned int GetNumTriangles ( )
inline

Returns the number of triangles in this strip

void SetTexCoords ( const float  x1,
const float  y1,
const float  x2,
const float  y2,
const float  x3,
const float  y3 
)

Set the texture coordinates to be used for the next triangle that is added (or subsequent triangles if this is not called again

Parameters
x1X coord of vertex 1
y1Y coord of vertex 1
x2X coord of vertex 2
y2Y coord of vertex 2
x3X coord of vertex 3
y3Y coord of vertex 3
Precondition
_texture != NULL && _stripified == false
Postcondition
_currentTex contains input values
void SetTexture ( Image image)

Set the texture to be used for this triangle strip. The triangle strip may only have one texture, so it is an error to call this more than once after StartBuildingStrip() has been called.

Precondition
_texture == NULL && _stripified == false
Postcondition
_texture == img
Parameters
imageThe texture to assign, or NULL if no texture
void StartBuildingStrip ( )

Sets this object into strip building mode. During strip building mode the user adds individual triangles to the strip When strip building mode is finished, the object will create a triangle strip from the individual triangles

Precondition
none
Postcondition
_stripified == false
void Stripify ( )
protected

Convert the set of ordered, connected triangles in this object into tristrip

Precondition
_stripified == false
_stripified == true

Member Data Documentation

V2f _currentTex[3]
protected

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

unsigned int _numTriangles
protected

The number of triangles in the strip

bool _stripified
protected

True if triangles have been created into a strip

unsigned int _stripSize
protected

The number of vertices in the strip

Image* _texture
protected

Texture to use when drawing strip. NULL if untextured

unsigned int _vboBufferSize
protected

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

unsigned int _vboHandle
protected

VBO Handle for this triangle strip

DynamicArray<V2f_T2f, true> _vertData
protected

DynamicArray to store vertex and texture coordinates

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: