Jump to content
  • Advertisement
Sign in to follow this  
hury

Text output speed problems

This topic is 3712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i draw several objects on the screen. Below each object i want to put an text description. I do it this way:
Quote:
glPushMatrix(); for(int _i=0; _i <= myIcons.getIconVector().at(i)->getName().length(); _i++) { glRasterPos3f ( myIcons.getIconVector().at(i)->getX()+_temp, myIcons.getIconVector().at(i)->getY(), myIcons.getIconVector().at(i)->getZ()); glutBitmapCharacter (GLUT_BITMAP_8_BY_13, myIcons.getIconVector().at(i)->getName()[_i]); _temp=_temp+0.045f; } _temp=0; glPopMatrix();
myIcons.getIconVector().at(i)->getX() gets me the positions for the coordinates myIcons.getIconVector().at(i)->getName()[_i] gives me the char from the string on position [_i] The Problem now is, when i activate this text drawing, the performance drops really badly. Is there an better way for text output or am i doing something wrong? Alex

Share this post


Link to post
Share on other sites
Advertisement
If the total amount of chars printed to the screen is large then its a bad idea to render it one char at a time. Can you give me some idea about the amount of chars you have?

Share this post


Link to post
Share on other sites
There are ~52 objects. Each has an description of average 10 chars.
So we end up with approx. 520 chars.

Share this post


Link to post
Share on other sites
The best way is to load a texture with the font sprite-sheet, and draw triangles manually via a streaming-draw VBO and a simplistic pair of shaders.
Your start-up, though should be to load that texture, and use glBegin(GL_QUADS), glVertex2f, glTexCoord2f and glEnd.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!