use fmod() when incrementing CubeRot

This commit is contained in:
Brian Paul 2006-01-30 15:35:35 +00:00
parent bd8c742762
commit 7905b19ec9
1 changed files with 3 additions and 4 deletions

View File

@ -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();
}