This "simple_font.cc" under-development example of using fonts is in the Chrome sources. I'm lucky I found it. It was surprisngly easy to take the image data and make it into a gl texture and continue to do everything with the 3d client - I'm guessing a 2d client and 3d client wouldn't play well together, but didn't actually try it. So far it's slow, though - I seem to be spending about ~20 msec on text alone - not sure how much of that is drawing the text and how much is uploading the texture - I'll do some profiling soon - and I haven't tried glMapTexSubImage2D() yet, from these tips.
http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/examples/font/
Just remember, you have an entire browser to render text for you. If you are not porting something then consider using HTML for your text if it fits your needs. The browser will composite your HTML and it will only re-render it when you change something.
Posted by: greggman | August 19, 2011 at 09:25 AM
Gregg, could you (or someone) link to some sample code or docs that show how to do that? I'm a web n00b and have no idea how to layer HTML text on top of the native client pane.
Posted by: Jamie Fristrom | August 19, 2011 at 10:35 AM
Rendering text would probably work best with an API like freetype (http://freetype.org). Freetype is the library used to render text in many linux programs including Chrome parsing glyphs from popular font formats (truetype, opentype, etc). It is very fast and efficient and implemented in C for easy integration.
The text could then be uploaded as a texture if you wanted to use it in OpenGL.
I hope this helps!
Posted by: Ben Gildenstein | August 20, 2011 at 10:23 AM
I just found this project that may interest you:
http://code.google.com/p/freetype-gl/
Posted by: Ben Gildenstein | August 23, 2011 at 06:05 PM