PDA

View Full Version : Text labels



07-26-2001, 06:59 PM
Hi people!

My question is:

How can I display text labels near the objects in my scene?

I want these labels to be translated with the image, so they CAN'T be attached to the viewport. It would be nice if I could rotate them as well. For example: I have a group of lines and want to display the labels rotated so as the lines look like they underline the labels.

Thanks.

mikael_aronsson
07-26-2001, 10:24 PM
Hi !

The options you have are:

1. use wglUseFontBitmaps(), this creates a bunch of displaylists, one for each character (X has glXUseFont... something), you can transform the raster position in any way you want, but the text itself cannot be rotated, it will always be facing the screen.

2. On Windows you can also use wglUseFontOutlines, this creates line strips or polygon display lists for each charcater and you can transform these in any way you including scaling and rotation.

3. Use textured fonts, create the text you want as a texture and map it to a polygon, this can also be transformed in any way you want, this is the fastest solution, but it has some limitations on the text as you have to create an image with the label, if you do a lot of scaling it may look a but ugly to....

Mikael

07-27-2001, 07:11 AM
Hi Mikael! Thanks for your reply.

I have implemented using the wglUseFontBitmaps but a problem arised: the app became VERY VERY slow.

The font size is 10 and I can have more than 5000 labels sometimes.

Like you said, textures are the fastest way to do this, but Im afraid its not suitable for my app because the user can change the font a lot. Is there a way to build the textures on runtime based on the font the user chooses?

Thanks.

zed
07-27-2001, 06:55 PM
http://www.lmnopc.com/bitmapfontbuilder/
generate the font onto a texture at runtime like the above app