Archived

This topic is now archived and is closed to further replies.

notme

Anti-Aliased Fonts

Recommended Posts

Are there ways to create anti-aliased(i.e. smooth) fonts on screen? I tried the tutorials on NeHe and the examples in the book; OpenGL Game Programming but the fonts appear "jagged and rough". Any help is appreciated.

Share this post


Link to post
Share on other sites
you could check out the freetype2 lib at sourceforge, you can get some VERY nice antialiased font bitmaps at run-time with that.

----------
http://www.zppz.com <- game dev stuff

Share this post


Link to post
Share on other sites
I was just going to post something similar, but might as well post it here...

I just finished getting Bitmap Fonts to work (NEHE Tut) and getting them to work in Ortho Mode (so I can specify pixel coords), but they are pretty jaggy... is there anyway I can anti-alias those? Maybe turn some blending feature on or something?

Thanks for the help

Share this post


Link to post
Share on other sites
I use texture fonts with an alpha channel, and they look nice and smooth. There''s a very good bitmap font generator program at http://www.lmnopc.com which I''ve found to be invaluable.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites
I''ve been fooling around with using ftgl library (which is an OpenGL library for freetype2). I''ve been having problems with textured fonts, I was wondering if anyone was experiencing similar?

At point sizes less than like 16, the texture fonts seem to be partly transparent and smeared out. I think this issue is related to the fact that they''re using an alpha texture for the font, but I haven''t tested my hypothesis yet by altering the library.

The piximapped fonts look fine but they''re just really slow, and I''m pretty sure this isn''t a 1-1 scaling issue, I''m using GL_NEAREST, and I''m not rendering the font pixels right on the pixel boundaries.

Btw, I did some profiling, drawing the same text string like 30000 times and timing it:
Textured fonts using GL_QUADS was the fastest.

Bitmapped fonts using glBitmap() were twice as slow as textured fonts - these are just fonts were the pixels are just 1/0 ... there is no alpha.

Piximapped fonts using glDrawPixels() are ten times as slow as textured fonts. They have 256 shades of alpha for nice antialiasing. (The reason this is obviously so slow is the glDrawPixels() call...)

Share this post


Link to post
Share on other sites
Thanks for the reply, but I made sure I was using GL_NEAREST for my textures and no mippmapping... The interesting thing was that the ftgl library internally used GL_LINEAR for the texture fonts which was really odd - had to change that.

Share this post


Link to post
Share on other sites
I use GL_LINEAR for my texture fonts, I think it works best since I use a fake 640x480 orthographic projection matrix no matter what res the display is actually in. I think nearest filtering would look a bit icky and not so smooth. But then I''ve never tried it, I just went straight for linear.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites
Yeah, if you''re not displaying your fonts at 1-1 or you''re displaying them so the fonts pixels fall inbetween screen pixels you need filtering of some kind, and not GL_NEAREST

Share this post


Link to post
Share on other sites