Results 1 to 8 of 8

Thread: Text rendering

  1. #1
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    Pori, Finland
    Posts
    191

    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?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    352

    Re: Text rendering

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

  3. #3
    Member Newbie
    Join Date
    Apr 2002
    Location
    Split, Croatia
    Posts
    43

    Re: Text rendering

    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.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    Pori, Finland
    Posts
    191

    Re: Text rendering

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

  5. #5
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    Pori, Finland
    Posts
    191

    Re: Text rendering

    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?

  6. #6
    Senior Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    442

    Re: Text rendering

    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.

  7. #7
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    Pori, Finland
    Posts
    191

    Re: Text rendering

    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?

  8. #8
    Member Newbie
    Join Date
    Apr 2002
    Location
    Split, Croatia
    Posts
    43

    Re: Text rendering

    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.

Similar Threads

  1. Text rendering class does not draw text
    By th0masr0ss in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-23-2015, 09:10 PM
  2. About Text rendering
    By mylogic in forum OpenVG
    Replies: 7
    Last Post: 03-11-2009, 09:42 AM
  3. Rendering text
    By martinho_ in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 09-03-2004, 02:48 PM
  4. Text Rendering
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 08-21-2003, 07:30 AM
  5. 3D text rendering
    By hanuni in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 03-11-2002, 04:12 PM

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