summaryrefslogtreecommitdiff
path: root/progs/demos
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-09-30 15:03:33 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-09-30 15:03:33 +0000
commitd0529b67f48507ce52ce06305fb2673f5beb2851 (patch)
tree5482e80e0c643ec71cd28ada668c4c57687628d7 /progs/demos
parent76560af99d36bbccb7e390c622ee83a9ec05a775 (diff)
use fmod() to prevent overflow of angle variable
Diffstat (limited to 'progs/demos')
-rw-r--r--progs/demos/gears.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/progs/demos/gears.c b/progs/demos/gears.c
index 679fac4489..ab9bc00742 100644
--- a/progs/demos/gears.c
+++ b/progs/demos/gears.c
@@ -234,7 +234,9 @@ idle(void)
dt = t - t0;
t0 = t;
- angle += 70.0 * dt; /* 90 degrees per second */
+ angle += 70.0 * dt; /* 70 degrees per second */
+ angle = fmod(angle, 360.0); /* prevents eventual overflow */
+
glutPostRedisplay();
}