optimizing Model drawing

This commit is contained in:
Chris Danford
2003-05-04 07:22:20 +00:00
parent 85986fe325
commit 4cbdfbf128
4 changed files with 41 additions and 50 deletions
+14
View File
@@ -472,12 +472,26 @@ void RageDisplay::DrawStrip( const RageVertex v[], int iNumVerts )
void RageDisplay::DrawTriangles( const RageVertex v[], int iNumVerts )
{
if( iNumVerts == 0 )
return;
ASSERT( iNumVerts >= 3 );
ASSERT( (iNumVerts%3) == 0 );
glInterleavedArrays( RageVertexFormat, sizeof(RageVertex), v );
glDrawArrays( GL_TRIANGLES, 0, iNumVerts );
g_iVertsRenderedSinceLastCheck += iNumVerts;
}
void RageDisplay::DrawIndexedTriangles( const RageVertex v[], const Uint16 pIndices[], int iNumIndices )
{
if( iNumIndices == 0 )
return;
ASSERT( iNumIndices >= 3 );
ASSERT( (iNumIndices%3) == 0 );
glInterleavedArrays( RageVertexFormat, sizeof(RageVertex), v );
glDrawElements( GL_TRIANGLES, iNumIndices, GL_UNSIGNED_SHORT, pIndices );
g_iVertsRenderedSinceLastCheck += iNumIndices;
}
/* Draw a line as a quad. GL_LINES with antialiasing off can draw line
* ends at odd angles--they're forced to axis-alignment regardless of the
* angle of the line. */