glutIdleFunc slow down animation

is there anyway to slow down the animation using glutIdleFunc function?

The idle function will be called repeatedly while there are no other events pending. In general, you should only install an idle callback if there’s work for it to do, and remove it when there is nothing for it to do, otherwise you’ll end up saturating a core calling the idle callback repeatedly.

If you want to sync to the rate at which you can redraw, update at the start of the display callback and call glutPostRedisplay() at the end of the display callback.

If you want to execute something approximately at a fixed rate, use a timer callback. You need to set a new timer from the callback to have the callback invoked continuously. Note that the timer callback will be called no earlier than the specified time; this results in the actual rate being slightly lower than expected.

To perform updates at a consistent rate regardless of the frame rate and without the drift caused by accumulated inaccuracy in the timer callback, check the current time at the start of the display callback and call the update function as many times as needed to catch up. E.g.

void display(void)
    static const double ticks_per_second = 60.0; // or whatever
    static int last;
    int now = glutGet(GLUT_ELAPSED_TIME);
    int tick = (int) floor(now * ticks_per_second / 1000);
    if (!last)
        last = tick-1;
    for ( ; last < tick; last++)

good I found this code on the net, thanks for all the help