View Full Version : Text rendering
05-02-2002, 07:20 AM
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?
05-02-2002, 08:03 AM
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).
05-02-2002, 09:33 AM
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
Sorry if you are already doing this, it wasnt clear from your post.
Hope this helps.
05-02-2002, 09:57 AM
Thanks for your post, I'll give a try for your ideas.
05-03-2002, 09:47 AM
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?
05-03-2002, 12:37 PM
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.
05-04-2002, 04:07 AM
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?
05-04-2002, 05:42 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.