projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a4a31c5
)
rotate at fixed rate (Marcelo Magallon)
author
Brian Paul
<brian.paul@tungstengraphics.com>
Sun, 9 Jan 2005 17:50:27 +0000
(17:50 +0000)
committer
Brian Paul
<brian.paul@tungstengraphics.com>
Sun, 9 Jan 2005 17:50:27 +0000
(17:50 +0000)
progs/demos/gears.c
patch
|
blob
|
history
diff --git
a/progs/demos/gears.c
b/progs/demos/gears.c
index e9061ed6c92637edb3870cee925e3dd6e2720fed..fc797eb904cc903c3ca93222bba5419978f42188 100644
(file)
--- a/
progs/demos/gears.c
+++ b/
progs/demos/gears.c
@@
-1,4
+1,3
@@
-
/*
* 3-D gear wheels. This program is in the public domain.
*
@@
-28,6
+27,7
@@
static GLint T0 = 0;
static GLint Frames = 0;
static GLint autoexit = 0;
+
/**
Draw a gear wheel. You'll probably want to call this function when
@@
-215,7
+215,14
@@
draw(void)
static void
idle(void)
{
- angle += 2.0;
+ static double t0 = -1.;
+ double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
+ if (t0 < 0.0)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
+ angle += 70.0 * dt; /* 90 degrees per second */
glutPostRedisplay();
}