I would like suggestions as to how to render text quickly in OpenGL.
Currently, I am reading a true type font and dynamically generating a texture containing all the ASCII characters, for each font used, for each font size used. Each texture is generated just once and kept for later use.
During the draw phase, I draw everything line by line.
I have a static array on memory, compute the kerning ect, modify the vertex positions and texture coordinates for the line. Then I bind the corresponding texture and render the line.
Unfortunately this seems to be very slow. Is there a better way?
Draw the rendered text to a texture, and then draw that texture to the screen. Store the texture between frames. You need some management of deleting text that is no longer visible on screen, but this should be magnitudes faster.
Graphics libraries usually abstract this as a String class that, once you draw it to the screen remembers the texture it drew and invalidates it if the internal string changes.