ChaneunBaek
ChaneunBaek

Reputation: 25

OpenGL/ How can I stop glutTimerFunc?

I want to make my human figure walk when I press '0', and stop when I press '0' again. I managed to make it walk as I want, but I do not know the way to stop glutTimerFunc.

Is there any OpenGL function that makes glutTimerFunc stop?

And here is my code.

if (key == '0') {
    if (!walk_working_flag) {//when walk does not working
        walk();
        walk_working_flag = true;
    }
    else {
        //stop walking
        glutTimerFunc(100, stop_animation , 0);
    }
}

in stop_animation function, no rotation occurs.

Thank you.

Upvotes: 0

Views: 516

Answers (1)

Cortex0101
Cortex0101

Reputation: 927

As stated in the API docs:

There is no support for canceling a registered callback. Instead, ignore a callback based on its value parameter when it is triggered.

Upvotes: 1

Related Questions