View Full Version : Text labels
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.
07-26-2001, 11:24 PM
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....
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?
generate the font onto a texture at runtime like the above app
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.