summaryrefslogtreecommitdiff
path: root/progs/samples/sphere.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-01-08 23:52:01 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-01-08 23:52:01 +0000
commitc1065ee977f70042e54a930a6cd3af819d4a9806 (patch)
tree45053d22bc302bde8c627e9e8d2cc174a17c844a /progs/samples/sphere.c
parent0261042bebe4c17afd3b581fac0ab5274dac3740 (diff)
compute reasonable animate rate (Marcelo Magallon)
Diffstat (limited to 'progs/samples/sphere.c')
-rw-r--r--progs/samples/sphere.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/progs/samples/sphere.c b/progs/samples/sphere.c
index cbe2cb1868..7d0508dee9 100644
--- a/progs/samples/sphere.c
+++ b/progs/samples/sphere.c
@@ -29,7 +29,7 @@
#include <math.h>
#include <stdlib.h>
#include <GL/glut.h>
-#include "../util/readtex.c"
+#include "readtex.h"
#ifndef PI
@@ -820,8 +820,16 @@ void Reshape(int width, int height)
void Idle(void)
{
- xRotation += .75;
- yRotation += .375;
+ static double t0 = -1.;
+ double t, dt;
+ t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+ if (t0 < 0.)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
+ xRotation += .75*60.*dt;
+ yRotation += .375*60.*dt;
glutPostRedisplay();
}