Text rendering

I have made a small utility that loads from a bitmap all the characters and makes them textures.
Should I render the chars of a text string in polygons (2d) or how? Are there something better for these kind of things in openGl?

Yeah, do 2d rendering (glOrtho) and draw textured quads (1 textured quad per character). That’s faster than glBitmap/glDrawPixels and gives you nice antialiasing/scaling/italic features. You can also do that in display lists so that rendering 1 whole string will be achieved in only 1 gl call (glCallLists).

Use only one texture for all characters, that way when rendering textured quads you only have to change texture coordinates for every character(quad) and you dont waste time making unnecessary
glBindTexture calls.
Sorry if you are already doing this, it wasnt clear from your post.
Hope this helps.

Thanks for your post, I’ll give a try for your ideas.

By the way, how much time does calling glBindTexture(…) take?
Is it faster to use one texture for all characters if the texture is 1024*256?

Thats a difficult question to answer. It depends on the drivers, overall texture load, amount of texture memory on the card etc. Basically, for a single character set, 1024x256 seems a bit large. It will take longer to initially bind (with glTexImage2D) but if it stays resident in video memory, it won’t make a difference on the glBindTexture execution.

You can set the priority of this texture (its a hint) if you want the drivers to make an extra effort to keep it on the card.

You can set the priority of this texture (its a hint) if you want the drivers to make an extra effort to keep it on the card

How can I actually do this? With glPrioritizeTextures()? If so, what does the last parameter mean?

Last parameter is floating-point value that is clamped to the range [0,1].
0 is lowest priority, 1 is highest priority.
If you want to prioritize just one texture it would go like this

GLfloat priority = 1.0f;
glPrioritizeTextures( 1, &your_texture_id, &priority);

If your texture is already bound you can also give hint with glTexParameter.
Look for these in glspec.
Hope this helps.