summaryrefslogtreecommitdiffstats
path: root/progs/demos/morph3d.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-01-09 17:37:50 +0000
committerBrian Paul <[email protected]>2005-01-09 17:37:50 +0000
commit92eddb0fd404624ca198f19e4088927701eec7f5 (patch)
treedd93d51d271e6bd43d09af9e8b0f3a98a640a8d2 /progs/demos/morph3d.c
parent516f9bc6e306fe7820649ead125d557b46ca8419 (diff)
better animate rate (Marcelo Magallon)
Diffstat (limited to 'progs/demos/morph3d.c')
-rw-r--r--progs/demos/morph3d.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c
index 2ce04a30992..047d571c705 100644
--- a/progs/demos/morph3d.c
+++ b/progs/demos/morph3d.c
@@ -660,6 +660,13 @@ static void draw_ico( void )
}
static void draw ( void ) {
+ static double t0 = -1.;
+ double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
+ if (t0 < 0.0)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
@@ -681,7 +688,7 @@ static void draw ( void ) {
glutSwapBuffers();
- step+=0.05;
+ step += dt;
}
static void idle_( void )