Fonts into textures


Just starting to play around with some typographical stuff in OF, was wondering what the best way of rending fonts into textures was? I’m trying to render individual letters, so I can make a basic particle system. I’ve done some searching, but I can only find examples where ofDrawBitmapString draws directly to the screen. Reason I wanted to put individual letters into textures was cause I wanted to be able to rotate them etc.

Any help much appreciated!

Cheers, sCam

you could render your text to a framebuffer (ofFBO) and then draw the fbo every time you need it.

With 007 you can also do getStringAsPoints() to get the points from the font as an ofPath that you could work with as points, manipulate as an ofVBO, or all kinds of other things. But if you want the precise outline of the font you’ll want to use ofTrueTypeFont and render that to an ofFBO as zuppaman suggests, that way it’s already on your graphics card and you just tell it where to render that to, saving you the need to re-upload textures to the graphics card each time.

OK thanks a lot guys, I’ll look into it. I had a sneaking suspicion I was gonna have to grapple with FBOs at some point!

Cheers, sCam

hey sCam,

I saw your post and it prompted me to upload an add on from the spring that may help.

it’s called ofxWordPalette, and basically let’s you pre-render a large amount of text to an FBO so you can render lots of text quickly… but also is an example of how to render type to an FBO so you can use shaders and the like with it,

check it out to see if it helps,

example screenshot: