Fast font rendering with per-character transformations

Nibbie
Posts: 2
Joined: 2009.09
Post: #1
I am looking for a way to render lots of text with many per-character transformations. For example a sentence in the form of a spinning circle, or a sentence floating around, following a Bezier curve.

I have tried with FTGL which has rather unpleasant API and doesn't work correctly with glOrtho.

Then I tried with QuesoGLC, which has really nice API, following the GLC specification and integrates seamlessly with OpenGL. Unfortunately I had awful performance hit when I tried to render several sentences, character by character.

GLFT seems like a great library for my goals, as it provides per-character transformation with display lists, when rendering entire strings of text. Unfortunately, although I compile the library correctly (with FreeType) I couldn't run the examples, because it states that it cannot create the font faces with the fonts I provide (arial.ttf, courier new.ttf, some unknown Type1 font).

Here is a video of what I want to achieve (implemented with QuesoGLC): http://www.youtube.com/watch?v=yM72XCqnb_c
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #2
I don't know anything about QuesoGLC or GLFT, but I tried FTGL years ago and didn't like the API either.

If you aren't changing the layout of the letters on the fly (like how your circles of text in the video don't change, except to rotate), then the most efficient way to do it is to render the text to a single texture. FreeType might be the best way to go, although you might be able to use Quartz more easily instead if you don't mind staying Mac-only. With FreeType, you'll have to transform the pixels yourself for each glyph and software-render them into your texture. That's how you'd use FreeType anyway, but you'd have the additional step of adding a 2D transform.

If you need to change the layout of the letters on the fly (e.g. animated waving text), then you'll probably have to take the old bitmap font approach of putting each character on a separate quad, so it can be transformed separately on the fly. This approach will logically be less efficient than a single quad for each sentence and hence may exhibit performance problems when rendering lots of characters, but is usually fine up to a point.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
I dunno, I've ben able to render hundreds of characters per frame using the bitmapped font approach without a noticeable speed hit. I've never really tried to figure out what the upper limit is, but it seems pretty high.

As long as your character transformations are simple matrix transforms, I can't really seeing it as being a big hit either. You already need to do a translation per character anyway.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #4
Ya, hundreds of bitmap-on-quad characters on modern hardware, no problemo. I remember back in the day, on the Rage128 being significantly affected when into the hundreds and trying to render other geometry at the same time though (of course we aren't dealing with Rage128's anymore -- maybe iPhone, but that can only display so much text at once at a time anyway because of the screen size). I guess it depends on what you're doing, but I'd guess the bitmap font approach should work just fine. It's definitely a lot easier than dealing with FreeType.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #5
I'm still working on a lightning-fast font library that should be able to do just about this. It's pretty much finished and it would be awesome to have a use-case to tune it to. PM me if you'd like a β build. Smile
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2009.09
Post: #6
Update on the situation. I made it work with FTGL. Using FTGLPolygonFont I can render hundred rotating short sentences without unbearable performance hits.
The only thing to notice is that I had to use a monospaced font to be able to correctly wrap a sentence in a perfect circle.

The downside is that I have to render a character, glRotated, another character, glRotated, etc...
It would have been really nice if there was an option to provide per-character/per-word/etc transformation options, like GLFT.

As for the β, I would be glad to try it out.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Fast rendering with OpenGL 1.1 dotbianry 4 3,679 Dec 18, 2012 03:58 AM
Last Post: dotbianry
  Font rendering problem wadesworld 5 3,606 Mar 18, 2009 11:11 PM
Last Post: AnotherJake
  fast billboards reubert 2 2,802 Oct 7, 2004 04:41 AM
Last Post: OneSadCookie
  Matrices and Transformations... Nevada 5 3,632 Jul 22, 2004 09:37 AM
Last Post: ThemsAllTook
  Too fast! Silden 7 4,000 Apr 16, 2003 02:40 PM
Last Post: Mars_999