Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: How to stop glutTimerFunc animation?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2010

    How to stop glutTimerFunc animation?

    I have an animation started with glutTimerFunc. I want it to last for 5 seconds and stop. How would I do that?


  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    If you look at the function signature

    Code :
    glutTimerFunc(unsigned int timeout, void( *callback )( int data ), int data);

    you have a minimal waiting time until your callback is called once. To coarsely approximate the time you already spent doing the animation you can simply calculate

    timeSpent = timeout * invocations

    and as soon as timeSpent >= 5000 you don't call glutTimerFunc anymore.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts