<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font face="serif">I have been experimenting with the GLFW timers
        and have come up with a workable solution for locking the frame
        rates to a desired value (something we must have in order to get
        the physics to display correctly).</font></p>
    <p><font face="serif">First:  you need to set glfwSwapInterval to
        ZERO.  If you have it set at one, it will lock you framerate a
        60fps.</font></p>
    <p><font face="serif">Second: you need a function to lock your
        framerate to a desired value.  Here is one I wrote:</font></p>
    <p><font face="monospace">void glfwLockFrameRate( float
        desiredFrameRate ){<br>
        <br>
             double secondsToWait = 1.0 / desiredFrameRate;<br>
             double startTime = glfwGetTime();<br>
             do { /* twiddle thumbs */ }<br>
             while ( glfwGetTime() - startTime < secondsToWait );<br>
        } <br>
      </font></p>
    <p>Now, my home system is running at about 4000 FPS on my code, so I
      cannot set the framerate above that.  But if I wanted to lock the
      framerate at 120 FPS I could simply call</p>
    <p>      glfwLockFrameRate(120);  <br>
    </p>
    <p>in the code.  I put this in my main just before calling the
      display function.   The next trick (and this will have to wait
      until I get back from my trip)  is to show you how do determine
      what framerate you need.</p>
    <p><br>
    </p>
    <div class="moz-signature">-- <br>
      <b><i>Andrew J. Pounds, Ph.D.</i></b><br>
      <i>Professor of Chemistry and Computer Science</i><br>
      <i>Director of the Computational Science Program</i><br>
      <i>Mercer University, Macon, GA 31207 (478) 301-5627</i></div>
  </body>
</html>