Jump to content
  • Advertisement
Sign in to follow this  
orochimaruSanin

OpenGL Continuous Scrolling Text in OpenGL ?

This topic is 4293 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

Hello to all game devs out there. I just thought of coding a simple application which will act like a marquee in OpenGL (the one which scrolls from left to right and repeats itself) I have written a simple app which does the same job with a simple rectangle, but i dont know how to do it with text. Any ideas or web sites links where i can get teh relevant material. Ideas on how to do it even would do. Thanks in advance for all your help. [Edited by - orochimaruSanin on October 18, 2006 1:12:56 PM]

Share this post


Link to post
Share on other sites
Advertisement
humm.. put text texture on your quad?? Especially if your quad is already doing the job.

You could use CreateFont and rasterPos to display windows fonts, but it's slow as hell. I consider using textured quad way better, you can even transform string into the correct amount of quads who use the correct part of the alphabet texture dynamically.

NeHe have a good tutorial for that: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=17

Share this post


Link to post
Share on other sites
If your text is on a textured quad, you can animated the four texture coordinates. Either by calculating the texcoords yourself, or utilizing the texture matrix:

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(offset.x,offset.y,0);
glMaxtrixMode(GL_MODELVIEW);

If the individual characters are seperate textured quads, just glTranslate them individually, and wrap the x coordinate if it passes the right screen border. If you're smart you make sure that you don't have to partially draw the same letter that clips the borders, i.e. make the marquee one char bigger than the screen width.

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!