summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-01-09 17:50:27 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-01-09 17:50:27 +0000
commita00c59151172cb7d77773ca0bb8adb388f58ea77 (patch)
tree68519004a9243611f2e23ec42638bc508a0c9fda /progs
parenta4a31c5d76874be8dd30f6809cc63fb27069c135 (diff)
rotate at fixed rate (Marcelo Magallon)
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/gears.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/progs/demos/gears.c b/progs/demos/gears.c
index e9061ed6c9..fc797eb904 100644
--- 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();
}