Results 1 to 4 of 4

Thread: Text labels

  1. #1

    Text labels

    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.


  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001

    Re: Text labels

    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....


  3. #3

    Re: Text labels

    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?


  4. #4
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010

    Re: Text labels
    generate the font onto a texture at runtime like the above app

Similar Threads

  1. NVIDIA drivers' labels
    By Aleksandar in forum OpenGL: User Software
    Replies: 13
    Last Post: 09-06-2009, 12:04 PM
  2. Hiding labels
    By devdept in forum OpenGL: Advanced Coding
    Replies: 19
    Last Post: 07-03-2009, 08:34 AM
  3. 2D annotations/labels on 3D canvas
    By KyleJones in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-03-2003, 08:32 AM
  4. bitmaped labels on a curved surface?
    By Roach in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 03-18-2003, 08:08 AM
  5. floating labels
    By fox in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 02-23-2001, 06:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean