title: glutTimerFunc problem
body: <p>I use <code>Glut</code> to make a simple animation. In the main function, <code>glutTimerFunc(TIMERMSECS, animate, 0)</code> is called. The two pieces of codes generate the same graphic.</p>
  
  <pre><code>const int TIMERMSECS = 20;
  float animation_time = 0;
  const float  animation_step = .5;
  </code></pre>
  
  <p><strong>Method 1:</strong></p>
  
  <pre><code>   void animate(int t){
          float time_elapsed = TIMERMSECS/1000.0;
          float current_step = animation_step* time_elapsed;
          glutTimerFunc(TIMERMSECS, animate, 0);
          if(current_step &lt; animation_step*2) 
                  animation_time += current_step;
          glutPostRedisplay();
  }
  </code></pre>
  
  <p><strong>Method 2:</strong> </p>
  
  <pre><code>   void animate(int t){
          float time_elapsed = TIMERMSECS/1000.0;
          float current_step = animation_step* time_elapsed;      
          if(current_step &lt; animation_step*2) 
                  animation_time += current_step;
          glutPostRedisplay();
         glutTimerFunc(TIMERMSECS, animate, 0);
  }
  </code></pre>
  
  <p>The only difference between them is the position of <code>glutTimerFunc</code>. For <code>Method 1</code>, it looks like a recursive that will never reach the end of <code>animate()</code>function. But why does that still work?</p>