Fonts in OpenGL

I’m developing an application where I’m required to display text in various fonts and colors. I need to use the windows standard Fonts Dialog Box for creating new fonts but I’m having problem in creating these fonts using wglUseFontOutlines(). When I try to scale them to the required size, the crispness goes away. Moreover these fonts are anyways not crisp as normal fonts.

What to do?

The difference in quality of the fonts you are seeing is most likely due to the “font smoothing” option. With that option enabled, Windows draws TrueType fonts with anti-aliasing. wglUseFontOutlines doesn’t create anti-aliased, or progressive, display lists. Producing anti-aliased, progressive meshes of font outlines would have to be handled quite a bit differently and would likely not involve display lists. Actually that sounds like a pretty complex task.

Why not trying to use texture mapped fonts and just rebuild a texture every time the user selects another font. This should be not that complicated. The only problem will be the amount of time required to rebuild the fonts, but if you can tolerate it in your project I would go that way.

-Lev

The texture approach is fine, indeed preferable, unless his outlines are extruded, which I was assuming they were.

Originally posted by Lev:
[b]Why not trying to use texture mapped fonts and just rebuild a texture every time the user selects another font. This should be not that complicated. The only problem will be the amount of time required to rebuild the fonts, but if you can tolerate it in your project I would go that way.

-Lev[/b]

Thanks for your reply.

Sorry, it is not tolerable in my project since I need to have many different types of font at the same time. They can be frequuently changed by the user any time. I tried to use wglUseFontBitmaps() but they have the follwoing problems:

  1. I don’t know how to scale them like polygons.
  2. They are hidden if clipped which is not desireable.

Please suggest some new method.

One approach I can think of is to use wglUseFontOutlines like you have been. But when you draw the characters, draw them several times, i.e. jitter and blend.

[This message has been edited by DFrey (edited 02-02-2001).]

Perhaps a bit off-topic, but how expensive is it to draw your average outline font? I’ve considered the “jitter and blend” antialiasing, but I hesitated because I need to do real-time rotations, etc. and can’t take much in the way of a speed hit to do nifty font effects. In retrospect, this is dumb reasoning since I would guess that the fonts don’t even come close to the rest of the scene I’m rendering, but hey…thought I’d ask anyway.

Chris

deepak, it sounds like OpenGL isn’t the ideal tool for developing your application.
Unless you also require lots of 3d polygons, I suggest that you look elsewhere.

Wanna displaying fonts under OpenGL !

Try : http://slug-production.ibelgique.com

Download section.

There is a example who display text on the screen. The example display a fps counter.