Skip to content

Commit 8e41f9d

Browse files
committed
1 parent 4e63682 commit 8e41f9d

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

libs/openFrameworks/graphics/ofTrueTypeFont.cpp

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,22 +1006,28 @@ void ofTrueTypeFont::drawChar(uint32_t c, float x, float y, bool vFlipped) const
10061006
// FIXME: optimize to addvertices, addtexcoords.
10071007
// this is called every frame every string.
10081008
// add index can be done only once (maybe)
1009-
stringQuads.addVertex(glm::vec3(xmin,ymin,0.f));
1010-
stringQuads.addVertex(glm::vec3(xmax,ymin,0.f));
1011-
stringQuads.addVertex(glm::vec3(xmax,ymax,0.f));
1012-
stringQuads.addVertex(glm::vec3(xmin,ymax,0.f));
1013-
1014-
stringQuads.addTexCoord(glm::vec2(props.t1,props.v1));
1015-
stringQuads.addTexCoord(glm::vec2(props.t2,props.v1));
1016-
stringQuads.addTexCoord(glm::vec2(props.t2,props.v2));
1017-
stringQuads.addTexCoord(glm::vec2(props.t1,props.v2));
1018-
1019-
stringQuads.addIndex(firstIndex);
1020-
stringQuads.addIndex(firstIndex+1);
1021-
stringQuads.addIndex(firstIndex+2);
1022-
stringQuads.addIndex(firstIndex+2);
1023-
stringQuads.addIndex(firstIndex+3);
1024-
stringQuads.addIndex(firstIndex);
1009+
stringQuads.addVertices({
1010+
{ xmin, ymin, 0.f },
1011+
{ xmax, ymin, 0.f },
1012+
{ xmax, ymax, 0.f },
1013+
{ xmin, ymax, 0.f },
1014+
});
1015+
1016+
stringQuads.addTexCoords({
1017+
{ props.t1, props.v1 },
1018+
{ props.t2, props.v1 },
1019+
{ props.t2, props.v2 },
1020+
{ props.t1, props.v2 }
1021+
});
1022+
1023+
stringQuads.addIndices({
1024+
firstIndex,
1025+
static_cast<ofIndexType>(firstIndex + 1),
1026+
static_cast<ofIndexType>(firstIndex + 2),
1027+
static_cast<ofIndexType>(firstIndex + 2),
1028+
static_cast<ofIndexType>(firstIndex + 3),
1029+
firstIndex
1030+
});
10251031

10261032

10271033
}

0 commit comments

Comments
 (0)