View Full Version : Text in OpenGL
03-26-2001, 05:39 AM
What is correct way to draw text it OpenGL application? glBitmap isn't accelerated and is extremely slow. Windows OpenGL text functions, that use call lists, use glBitmap internally, as I understand, therefore is unusable too.
03-26-2001, 05:55 AM
You should use texture quads. With all your characters on as fewer textures as possible. Q3 just uses 1 256X256.
1) Do all your 3D stuff 1st.
2) Setup glOrtho mode.
3) For each character in string, draw quad with appropriate texture coords for that character in the font texture.
4) Repeat for all strings.
It doesn't get much more simple, or faster than that.
03-26-2001, 11:30 AM
Well, thank you much, that sounds simple! For now I used texture 16x16 for EVERY char and perfomance was not very nice. I guess, that was my mistake. I'll try same texture for all chars now.
03-27-2001, 08:20 AM
I do as you said, but perfomance is same, as when I used texture for every char. Still slow. Well, some other specifictions needed. Maybe, another texture format (I used 32 bits per texel). Or something another...
I've got NVidia Riva Vanta 16MB AGP and all of my textures easily reside in its local videomemory...
that is the fastest way as used by quake3 et al (using one texture containing the whole alphabet. eg for a 256x256 texture you can fit 256 16x16 characters on it. enough for the whole ascii characters )
03-28-2001, 12:45 AM
I know I'm just being REALLY picky here but you should use 2 triangles, not a quad just to squeeze that extra little bit of performance out of the system.
Don't use 32 bit values. You should use a very low color image (maybe 16 colors) and change the palette when you map them. Have a look at the alphabet file for the menu letters in Q3 and you'll see it's a very low color TGA file. Also, if you use the console and do /r_showtris 1 then you can see how it's all done!!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.