summaryrefslogtreecommitdiffstats
path: root/progs/demos
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-01-30 15:35:35 +0000
committerBrian Paul <[email protected]>2006-01-30 15:35:35 +0000
commit7905b19ec9edd661ee18fcb0b210dc113b58974a (patch)
treecf5dc795355a07b55d3fec8b3b9eb9f919f51157 /progs/demos
parentbd8c742762e1f4dc3195bbf0acd2fe21d3447c00 (diff)
use fmod() when incrementing CubeRot
Diffstat (limited to 'progs/demos')
-rw-r--r--progs/demos/gearbox.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/progs/demos/gearbox.c b/progs/demos/gearbox.c
index fa4cbe726fc..3a1662cd625 100644
--- a/progs/demos/gearbox.c
+++ b/progs/demos/gearbox.c
@@ -325,10 +325,9 @@ idle(void)
dt = t - t0;
t0 = t;
- GearRot += 70.0 * dt; /* 70 degrees per second */
- GearRot = fmod(GearRot, 360.0); /* prevents eventual overflow */
-
- CubeRot += 15.0 * dt;
+ /* fmod to prevent overflow */
+ GearRot = fmod(GearRot + 70.0 * dt, 360.0); /* 70 deg/sec */
+ CubeRot = fmod(CubeRot + 15.0 * dt, 360.0); /* 15 deg/sec */
glutPostRedisplay();
}