<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Nobody has reached out to me about needing assistance in class
      tomorrow.  Since it was going to be a "workday", I am officially
      cancelling class tomorrow.  You can still come use the lab if you
      would like.</p>
    <p>Now -- some gifts come in small packages... and since we are are
      not having class tomorrow, and since I have not seen any houses
      "moving", I wanted to give you a snippet of code (a small package)
      that is found in my own 3D house code.  I have replaced my
      "pipeline code", which built the translation and rotation matrices
      and applied them to the coordinates, with the following OpenGL
      transformations.<br>
    </p>
    <p><font face="monospace">void pipeline(void)<br>
        {<br>
           spinX(); spinY(); spinZ(); <br>
           glRotatef(SPIN_ANGLE_X,1.0,0.0,0.0);<br>
           glRotatef(SPIN_ANGLE_Y,0.0,1.0,0.0);<br>
           glRotatef(SPIN_ANGLE_Z,0.0,0.0,1.0);<br>
           glutPostRedisplay();<br>
        }</font><br>
      <br>
      where the SPIN_ANGLE_X,Y,Z global variables are modified by their
      representative functions...</p>
    <pre class="code highlight" lang="c"><span id="LC350" data-testid="content" class="line" lang="c"><span class="hljs-type">void</span><span class=""> </span><span class="hljs-title.function">spinX</span><span class="hljs-params"><span class="hljs-params">(</span><span class="hljs-type">void</span><span class="hljs-params">)</span></span></span>
<span id="LC351" data-testid="content" class="line" lang="c"><span class="">{</span></span>
<span id="LC352" data-testid="content" class="line" lang="c"><span class="">      SPIN_ANGLE_X </span><span class="">= SPIN_ANGLE_X + DELTA_SPIN_X;</span><span class=""></span></span>
<span id="LC353" data-testid="content" class="line" lang="c"><span class="">      </span><span class="hljs-keyword">if</span><span class=""> </span><span class="">(SPIN_ANGLE_X > </span><span class="hljs-number">360.0</span><span class="">)</span><span class=""> SPIN_ANGLE_X </span><span class="">= SPIN_ANGLE_X - </span><span class="hljs-number">360.0</span><span class="">;</span><span class=""></span></span>
<span id="LC354" data-testid="content" class="line" lang="c"><span class="">}</span></span>

</pre>
    <p>and the  DELTA_SPIN_X,Y,Z global variables are set in the mouse
      function.<br>
    </p>
    <p>You are welcome to use this coding paradigm in your own code. 
      Remember to call glutPostRedisplay after you change the state of
      your graphics window ( you will also need to make sure that you
      have double buffering set up correctly).</p>
    <p>I hope this helps you - and please let me know if you have
      questions.  I may not have internet access on Wednesday - but if I
      do I will be answering questions.  <br>
    </p>
    <p><br>
    </p>
    <div class="moz-signature">-- <br>
      <b>Andrew J. Pounds, Ph.D.</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>