I recently noticed that some of the text in my Cinder-based application wasn’t particularly legible, prompting me to compare 2 font rendering approaches in Cinder. This screenshot is from a barebones application:
The top text rendered using a
The bottom text rendered using
render(), placing the text into a
ci::gl::Texture2dRef to then render.
The top text is far more legible in my opinion, and from a GUI standpoint preferrable.
Until now, I preferred the 2nd approach simply because it seemed to me that it’d be less resource intense, given that you’d do all the ‘difficult’ rendering once, get your texture and then perpetually reuse it if the text didn’t ever change. Now, I’m a bit more inclined to think that having 100+ labels of text (which I do have) each requiring their own texture is perhaps actually far more resource intense than using a single
ci::gl::TextureFontRef that gets
drawString() called. Yes, it means doing the render calculation at every draw call, but it also eliminates potentially 100+ texture swaps.
So I have 2 questions to pose to the Cinder brain-trust:
- Any ideas why the top text is bolder? Both approaches use the same
ci::Fontobject and don’t otherwise supply font modifying settings. I’m wondering if simply the
ci::gl::draw()call for the texture in the 2nd approach does some sort of blending that doesn’t happen for the top text?
- Any one else have any best practices advice? Given how far more legible the top version is, I’m inclined to swap to its rendering approach.