View Full Version : fonts
04-12-2001, 08:54 AM
Hello, I need to display 100-200 text characters in various sizes on my screen. Currently I do this with a bitmapped font, done per the Red Book example, which looks OK and is flexible as far as coloring goes, but it is very slow to draw (it seems like 50-60 ms for this many characters). I've tried using a font texture map and it is much faster but looks like hell, especially the smaller font sizes, and I can't get the text to change color. Is there some way to get OpenGL and my hardware (i810) to "convert" the bitmap for each character into something the 810 could handle like a texture? In other words, how can I get text to draw quickly?
04-13-2001, 08:38 PM
Treat texture fonts like any other textures.
The speed of bitmap fonts depends very much on the hardware. Putting them in a display list can make a big difference.
Sure, you can write a program to convert your bitmap fonts to texture fonts but this is probably not the easiest way to do it. Many small libraries for texture fonts exists and I think all of them have some collection of premade fonts.
04-14-2001, 10:19 AM
I am working with bitmap fonts too and I can confirm that they are very slow (when they are >100), even if included in display lists.
Maybe with texture fonts you are not using a size that is accelerated... With some patience you can use a texture size that is "always" supported by hw (256x256) and contains all the characters. Then when you need to display them you'll assign different texture coords to the polys.
Maybe adding some filtering to do 'antialiased' fonts.
04-16-2001, 09:54 AM
I do put the bitmaps into display lists, as in the Red book example. For more info, I'm using a font texture tool from the cgfont web site. The program is called template, and it lets you pick a font from a large list (of the few I've tried, the twentieth century ML looks best) and save it as a 512x512 color BMP in the 16-bit/pixel 5-5-5 format (5 bits each for RGB). I convert this to a 32-bit/pixel RGBA array because I can't see where OpenGL allows the 5-5-5 format (does it?). Since I only convert at startup, this isn't a problem as far as speed goes. The texture is a 10x10 grid of characters (blank in the lower left, progessing to ~ in the middle of the top row), from which I create 96 texture maps of the individual characters and then use glCallLists(strlen(string), GL_BYTE, string)
If anyone knows of a font texture that is made for displaying on a 640x480 LCD screen, can you point me to it?
[This message has been edited by nickn (edited 04-16-2001).]
04-16-2001, 09:03 PM
It is many librarys for texture fonts. Here is one of the original http://reality.sgi.com/opengl/tips/TexFont/TexFont.html
More fonts to the above can be found in the PLIB example distribution http://plib.sourceforge.net/
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.