<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font face="serif">Yesterday was interesting.  I woke up thinking
        about graphics.  On Thursday and Friday I was struggling with
        how to implement proper timing in our graphics programs because
        simply displaying the FPS in the terminal window was forcing a
        callback to the screen driver - which would be locked at 60
        FPS.  To get things like I wanted them I would have to do all of
        the FPS timing INSIDE of the graphics without the use of printf
        to the screen.  In my mind that meant having to display the FPS
        inside the graphics window -- which brought me back to the
        familiar problem of how to get the text to show up in the
        window.</font></p>
    <p><font face="serif">Getting the text to show up in the window is
        something I have done before - but it took a lot of work and I
        wasn't necessarily ready to throw that at you.  Without this
        ability, however, it was going to be impossible for you to get
        really good actual timings off of your code and synch it
        properly to the physics.<br>
      </font></p>
    <p><font face="serif">So on Saturday morning, around 10 am, I went
        into "Monk Mode" - which means I closed myself off in my study,
        turned on some classical music, dug out all my OpenGL reference
        manuals, and solved the problem.  It took until about 3 pm - but
        it did not seem like it at all.  For those of you that took CSC
        330 -  I was in "flow".  I also have to give a shoutout to 
        Eduardo Luciani who wrote a newer tutorial combining OpenGL 4.6
        and FreeType 2 (all of my prior code used much earlier versions
        of GL and was MUCH more complicated).  His tutorial helped me
        take some shortcuts that I can pass on to you.   To make all
        this little easier for you to digest - I tried to break my
        solution up into code pieces that you can implement in your own
        code.  These are:</font></p>
    <ol>
      <li><font face="serif">void buildFonts()  - build the font cache
          in memory from the Arial TrueType font using the FreeType2
          library.  This needs to be called in "init" or else it cuts
          the framerate by roughly a factor of 20 (I tried it both ways)<br>
        </font></li>
      <li><font face="serif">std::string showFPS() - to calculate the
          FrameRate on the fly using glfwGetTime function (still
          checking the granularity/accuracy/reproducibility)</font></li>
      <li><font face="serif">void doOrthoGraphics() - called in the
          display function after all of the 3D work to:</font></li>
      <ul>
        <li><font face="serif">Load two new ORTHOGRAPHIC oriented vertex
            and fragment shader programs</font></li>
        <li><font face="serif">Set up new texture based buffers for the
            graphics card<br>
          </font></li>
        <li><font face="serif">Set up a 2D orthographic projection on a
            portion of the screen</font></li>
        <li><font face="serif">Calculates the frame rate using showFPS</font></li>
        <li><font face="serif">Writes the FPS string to an OpenGL
            Texture object using the font cache created in buildFonts<br>
          </font></li>
        <li><font face="serif">Display the texture in the orthographic
            window</font></li>
      </ul>
    </ol>
    <p><font face="serif">I'm still working to repackage all of this for
        you (more comments as well as describing what new structs and
        global variables have to defined) and I have yet to test my lock
        for the framerate so we can synch to the physics, but it all
        seems to be working and I'm getting roughly 4000 FPS off of my
        NVidia GTX.  I'll keep you posted on the progress.<br>
      </font></p>
    <p><br>
    </p>
    <p><img src="cid:part1.8oxR3kiN.I0jb99Xw@mercer.edu" alt="" class=""
        width="600" height="600"></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>