I have a sphere drawn on the screen. When I press a button I want the sphere to slowly move to the right. I am trying to accomplish this with
for (int i = 0;i<10;i++)
{
sphere.moveToRight(0.1);
glutPostRedisplay();
sleep(1000);
}
But instead of animated, it waits a few seconds and then draws the sphere in the final location. I assume it is because sleep is stopping the glutPostRediplay(). Any ideas of how to accomplish this basic annimation?