Efficient text display/fade-in/out

I’m displaying a large amount of text onscreen that I’m wrapping using ofxTextSuite, which is a great addon, but has the annoying effect of recalculating the position and redrawing each word on every draw(). This has been causing major frame loss on my Raspberry Pi, which can’t handle drawing hundreds of words and smooth fades at the same time.

I’ve been trying to think of ways to speed this up and I thought about using FBOs. I’ve modified the addon to draw to an ofFbo once, and then simply call the FBO on subsequent frames (which dramatically reduces my frame dropage). But what I’d like to do is to change the overall alpha of this FBO in order to have the fade-in effect. I feel as if this ought to be more efficient than the implementation in ofxTextSuite, but I can’t figure out how to code the alpha change, so I haven’t been able to try it yet.

Or, perhaps there’s a better way to do this? With what I’m looking for I hope to only have to redraw the text when I’m changing the content of the text, not when I want to make a change in color/alpha. Thoughts?

Hi nknouf,

I’m fairly new to OF, but I’ve been working with alpha lately so I’ll throw in some ideas.

Can you get the texture reference for the ofFbo, iterate through its ofPixels and change the alpha channel to the values you’re looking for?

Or can you change ofColor of your text over time to have a growing alpha value, then ofEnableAlphaBlending?

Hope these ideas will lead you to better ones.

Thanks so much…I’ll try those ideas. I was hoping to not have to cycle through all of the ofPixels in my code, but that might be the only way of doing this, and it might be faster than redrawing all of the words on each frame. I’ll give it a shot and update the post with my findings.