Archived

This topic is now archived and is closed to further replies.

question about drawing an odometer

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

Dear all, I am trying to draw a odometer!! First, I draw a quads with a single texture mapped. Below is a simple example contents of my texture: 1 2 3 4 5 6 7 8 9 What I am trying to do is scrolling the texture on the quads, but I am wondering how to control it so that after displaying number "1", it will continue with "2", "3" and .....(these effect will be scrolling up). Should I control it by texture coordinates? Please guide me, thanks.

Share this post


Link to post
Share on other sites
Hmmm... The easiest way to do this is to modify the texture matrix. But this will be a little slow.

glMatrixMode(GL_TEXTURE);
... // Whatever you want to do to make the odometer move, glRotatef, glTranslatef, anything...
glMatrixMode(GL_MODELVIEW);

Share this post


Link to post
Share on other sites
You may want a "0" in the texture too

It would also be easier (if your odometer scrolls vertically) to keep the numbers in the texture vertical

0
1
2
3
.
.
.
8
9

Then just update your ''t'' tex coord when you''re texture mapping the quad/triangles.

---
K-1 Productions: Come visit us here.

Share this post


Link to post
Share on other sites
K-1''s suggestion is very good and fast. James, I like your idea
I need more flexible method...eg:
if my texture''s numbering changes to graphical symbols, how do I scrolling one of those symbols and then JUMP to another symbols and continue scrolling??
James, I haven''t try your idea, is it work on the flexible method as above?
Any idea from others ??

Share this post


Link to post
Share on other sites
then split that quad into two quads and modify the vertics in the same rate as you are scrolling them

The quads share the same space as your original quad.
In the beggining the top quad take 100% of the space, and in the end the bottom one takes up 100% of the space.
When it''s halfway there both quads take up 50% of the space each.

Share this post


Link to post
Share on other sites