Draw strings in batches. This results in glDrawArrays calls being dramatically reduced, although it's still not perfect. Note: This breaks drawing strings which use multiple maps.

This commit is contained in:
Colby Klein
2011-02-27 20:30:44 -08:00
parent 51e6e47fa4
commit e1e7db4758
+6 -2
View File
@@ -328,6 +328,9 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
} }
} }
vector<RageSpriteVertex*> vertices;
int iNumVertsToDraw = 0;
for( int start = iStartGlyph; start < iEndGlyph; ) for( int start = iStartGlyph; start < iEndGlyph; )
{ {
int end = start; int end = start;
@@ -350,12 +353,13 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
Actor::SetTextureRenderStates(); Actor::SetTextureRenderStates();
RageSpriteVertex &start_vertex = m_aVertices[start*4]; RageSpriteVertex &start_vertex = m_aVertices[start*4];
int iNumVertsToDraw = (end-start)*4; vertices.push_back(&start_vertex);
DISPLAY->DrawQuads( &start_vertex, iNumVertsToDraw ); iNumVertsToDraw += (end-start)*4;
} }
start = end; start = end;
} }
DISPLAY->DrawQuads( vertices[0], iNumVertsToDraw );
} }
/* sText is UTF-8. If not all of the characters in sText are available in the /* sText is UTF-8. If not all of the characters in sText are available in the