question about drawing an odometer

Started by
4 comments, last by nightkey 21 years ago
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.
Advertisement
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);
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.
---K-1 Productions: Come visit us here.
K-1''s suggestion is much faster than modifying the texture matrix, and you should definitely go for that one instead.
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 ??
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.

This topic is closed to new replies.

Advertisement