0
votes

I'm currently using the Freetype library to render text to my opengl es 2.0 app (both ios and android) and I've come to the point where I seriously have to consider performance. I have a store of textures (one for each character) and whenever I render text, the character calls from that texture area and then opengl binds to it, renders it to the screen... For each letter! Very inefficient. So, I'm looking into ways to make this faster, and one of the ideas I had was to pre render each word instead of each letter. So, now for the big question: How do I combine textures side by side? I know I need to create a buffer and that somehow it will come from FT_LOAD_CHAR, but I don't really know much else.

1
"Very inefficient." Why is that inefficient? - Nicol Bolas
Are you asking how to make a png from other pngs, or how to draw only parts of a combined png (texture "atlas")? - Richard Klassen
It's very inefficient because it is relatively costly to bind a texture to OpenGL. When you do it for every character... not good. Currently trying to follow codetiger's answer. - iHowell

1 Answers

2
votes

Actually, you have misunderstood how to use FreeType. You can load font using FT library and load all characters in to a single bitmap texture. Then you can just use texture coordinates to point the right UV. This link can help to some extend. Draw FreeType Font in OpenGL ES