I'm implementing a GUI built on top of OpenGL. I came to the problem that each GUI will have -- text rendering. I know of several methods of rendering text in OpenGL, however, I'm wonderin which of them would be best suited for a GUI.
Generally in a GUI we have two types of text -- static and live. Static is easy enough -- we can render a TTF to a texture and forget about it. It's the "live" text that is more bothering me -- imagine console, or a live chat in a multi-player game.
I thought of several options:
- no special cases -- render and load a texture each time the text changes, keeping in mind only to rerender it when actually new text appears, and trying to split the larger text into small parts (like per chat line). However this would still leave us hanging in cases like a score line that changes all the time, or a intro text that renders "per character" (typewriter style seen in some sci-fi games)
- quad-per character -- this also seems a popular solution, you prepare a texture with the ASCII table and render a textured quad character. However, I have serious doubts about the efficiency of such a solution. Tips how to make that faster would also be welcome.
- hybrid solutions -- however I have no idea how to implement that cleanly
The question hence is -- how to render text in OpenGL efficiently?
(if this helps, I'm coding in STL/Boost-heavy C++ and aiming at GForce 6 and later graphics cards)
Any suggestions welcome.