wglUseFontBitmaps - Performance Hit

I recently decided to add win32 functionality to my text using wglUseFontBitmaps() and the accompanied glListBase/glCallLists calls.

frame rate before wglUseFontBitmaps( and that blasted glRasterPos()) 100+
frame rate after (displaying 20x50 = 1000 chars) < 10…

is there something i’m doing wrong? the display lists created call glBitmap, don’t they? the only possibility i can come up w/, other than a speed hit from glBitmap, is that i’m running out of texture memory, due to the 96 display lists that are being used. even if that’s not the case, i’m sure it’s faster just to load my own 96-char texture and use quads to blt my text, as i’ve done this before, but then i’m stuck w/ making an external texture for each font, and i’m trying to be user friendly in this app…

just curious if anyone has had a similar hit and their method of combating it…

sys specs:
NT 4.0
256M ram
PIII 950
crappy ATI 128

thank you for your bandwidth

[This message has been edited by Succinct (edited 01-26-2001).]

This is normal behavior.

The best you can do for speed is writing your own(but then like you said you need to make your own font) or you can use free library from the web.

There is GLF from Romka graphics(it uses a C interface) or
what I use : fnt from PLib. PLib is free portable library. I don’t remember the sites addresses, but you can easely find them through google.

You can use GDI to draw the font to a memory DC and then you can load it up as one or more textures. You’ll also need to get the “A, B and C” widths of the characters with GetCharABCWidthsFloat. As well as get the height, ascent, and descent of the font with GetTextMetrics. Indeed you’ll want to do that first so you can make your memory DC big enough to hold the font (or portion thereof).

ok, trackin (made a gdi tetris game back in the day)

i’ll have to use SaveDIBits, right?

I’m not familiar with SaveDIBits. However I know you can use GetDIBits to copy the bitmap bits to a buffer which you then pass to OpenGL when loading the texture (assuming the image doesn’t need resizing first). And one clarification, my previous post may sound like I was suggesting that the bitmap should be saved, and then loaded from disk. I am not suggesting that.

Couple other details I thought of. When getting the sizes, make sure the memory DC is set to MM_TEXT mapping mode. Also you may want to get the kerning pairs for the font with GetKerningPairs, so that you can properly draw proportional text.

For what it’s worth, I’ve found this link: http://www.tasteofhoney.freeserve.co.uk/BmpFonts.htm#intro

It’s a D3D tutorial, but I think it’s a good step-by-step of what everyone’s suggesting here.

Jason/Maunikar

It fills this discussion like a polar bear in africa but…

Did someone had problems with wglUseFontBitmaps on Win2k ??

I’ve recently done a Win2k Professional plain installation (+ servicepack) and that funtions displays nothing, while it works on every other (MS) OS.

I’ts me or what ??

Thanks guys.

I’ll be implementing this seconds after i hit “submit reply”