- const float x1( xOffset + positions[i].x );
- const float x2( xOffset + positions[i].x + glyphs[i].width );
- const float y1( yOffset + positions[i].y );
- const float y2( yOffset + positions[i].y + glyphs[i].height );
-
- AddVertex( vertices, x1, y2, blobCoords[0].u, blobCoords[0].v );
- AddVertex( vertices, x1, y1, blobCoords[1].u, blobCoords[1].v );
- AddVertex( vertices, x2, y2, blobCoords[2].u, blobCoords[2].v );
- AddTriangle( indices, idx, idx+1, idx+2 );
- idx+=3;
-
- AddVertex( vertices, x1, y1, blobCoords[1].u, blobCoords[1].v );
- AddVertex( vertices, x2, y2, blobCoords[2].u, blobCoords[2].v );
- AddVertex( vertices, x2, y1, blobCoords[3].u, blobCoords[3].v );
- AddTriangle( indices, idx, idx+1, idx+2 );
- idx+=3;
+ // Get the color of the character.
+ const ColorIndex colorIndex = useDefaultColor ? 0u : *(colorIndicesBuffer + i);
+ const Vector4& color = (useDefaultColor || (0u == colorIndex)) ? defaultColor : *(colorsBuffer + colorIndex - 1u);
+
+ const float x1(xOffset + positions[i].x);
+ const float x2(xOffset + positions[i].x + glyphs[i].width);
+ const float y1(yOffset + positions[i].y);
+ const float y2(yOffset + positions[i].y + glyphs[i].height);
+
+ AddVertex(vertices, x1, y2, blobCoords[0].u, blobCoords[0].v, color);
+ AddVertex(vertices, x1, y1, blobCoords[1].u, blobCoords[1].v, color);
+ AddVertex(vertices, x2, y2, blobCoords[2].u, blobCoords[2].v, color);
+ AddTriangle(indices, idx, idx + 1, idx + 2);
+ idx += 3;
+
+ AddVertex(vertices, x1, y1, blobCoords[1].u, blobCoords[1].v, color);
+ AddVertex(vertices, x2, y2, blobCoords[2].u, blobCoords[2].v, color);
+ AddVertex(vertices, x2, y1, blobCoords[3].u, blobCoords[3].v, color);
+ AddTriangle(indices, idx, idx + 1, idx + 2);
+ idx += 3;