<?xml version="1.0"?>
<!-- name="generator" content="blosxom/2.0" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
  <channel>
    <title>/var/spool/weblog   </title>
    <link>http://www.kenytt.net/spool</link>
    <description>UNIX, Perl, Python, and a short fuse</description>
    <language>en</language>

  <item>
    <title>Learn to Program</title>
    <link>http://www.kenytt.net/spool/2006/07/13#1152840631</link>
    <description>
I'm a big fan of the &lt;a href=&quot;http://www.pragmaticprogrammer.com/&quot;&gt;Pragmatic Programmers&lt;/a&gt;, so when Ruby first appeared on the scene I bought a copy of the &lt;a href=&quot;http://www.rubycentral.com/book/&quot;&gt;first edition&lt;/a&gt; of &lt;i&gt;&lt;a href=&quot;http://www.pragmaticprogrammer.com/titles/ruby/index.html&quot;&gt;Programming Ruby&lt;/a&gt;&lt;/i&gt;.

&lt;p&gt;

Honestly, it failed to grab me.  It looked like a nice enough language, but its syntax is sort of a hybrid of Perl and Python. Given that I already know both Perl and Python, I couldn't see the point of spending much time on Yet Another Language, especially one that was more of the same.

&lt;p&gt;

Still, buzz continued to grow.  I picked up a copy of Hal Fulton's book &lt;i&gt;&lt;a href=&quot;http://rubyhacker.com/coralbook/&quot;&gt;The Ruby Way&lt;/a&gt;&lt;/i&gt;.  This one included Appendices explicitly for Perl and Python programmers, as well as several &quot;real-world&quot; examples, so I gave it another shot.

&lt;p&gt;

Actually, I &lt;i&gt;started&lt;/i&gt; to give it another shot.  But since the Appendices were squarely aimed at me, I started there.  Big mistake -- I fell asleep.  Several times.  I put the book aside and figured I was done.

&lt;p&gt;

Three years later, in 2004, along came &lt;a href=&quot;http://www.rubyonrails.org/&quot;&gt;Ruby on Rails&lt;/a&gt;.  Wow.  Do I really need to tell you how impressive Rails is?  But at the time I wasn't working on any web applications, I still wasn't thrilled with Ruby as a language, and I certainly wasn't thrilled at the prospect of learning a whole new language just to write web apps.

&lt;p&gt;

More recently I've been looking at the &lt;a href=&quot;http://www.h3rald.com/articles/view/rails-inspired-php-frameworks&quot;&gt;cavalcade&lt;/a&gt; of &lt;a href=&quot;http://www.larsen-b.com/Article/216.html&quot;&gt;Rails&lt;/a&gt; &lt;a href=&quot;http://www.perl.com/pub/a/2005/06/02/catalyst.html&quot;&gt;clones&lt;/a&gt;.  I think I've settled on &lt;a href=&quot;http://www.cakephp.org/&quot;&gt;CakePHP&lt;/a&gt; as the best documented, most mature, and easiest to learn.  But just as I was getting started, it occured to me....

&lt;p&gt;

As I tell students, the best way to learn is by going straight to the source, not by reading the n&lt;sup&gt;th&lt;/sup&gt; re-hash by someone else.  I'm still planning to learn Cake, but really, why not start with the best?  (Or at least with the original.)

&lt;p&gt;

Ok, back to Ruby.  In the years since &lt;i&gt;Programming Ruby&lt;/i&gt; was published by Addison-Wesley, the Pragmatic Programmers have started their own publishing company, &lt;a href=&quot;http://www.pragmaticprogrammer.com/bookshelf/&quot;&gt;The Pragmatic Bookshelf&lt;/a&gt;.  Which brings me (finally) to the ostensible subject of this review, &lt;i&gt;&lt;a href=&quot;http://www.pragmaticprogrammer.com/titles/fr_ltp/&quot;&gt;Learn to Program&lt;/a&gt;&lt;/i&gt; by Chris Pine.

&lt;p&gt;

The purpose of &lt;i&gt;Learn to Program&lt;/i&gt; is, well, to learn to program.  The language just happens to be Ruby.  Honestly, I don't even remember when I first learned to program -- I must have been 7 or 8 years old.  (BASIC, on a Timex-Sinclair 1000, if you must know).  I can't really comment on how well the book succeeds in that goal, because I'm clearly not the target audience.

&lt;p&gt;

I read through the book fairly quickly, since I already understand the concepts.  A couple of things concerned me, though.  The explanation of &quot;variables&quot; seemed overly complicated.  I think the author was trying to explain references, without actually using the word &quot;reference&quot;.

&lt;p&gt;

Ditto his explanation of recursion -- I admire the attempt to suggest that recursion is a perfectly natural concept (the title of Chapter 10, on recursion, is &quot;There's Nothing New to Learn in Chapter 10&quot;), especially since most CS1 textbooks for imperative languages make it far too complicated.  But c'mon.  If it's so easy, why does &quot;nothing new&quot; take 17 pages to explain?

&lt;p&gt;

So I can't tell you whether it's a good book for a beginner, but it was a good book for me.  The truth is, the only way to learn a new programming language is to write code.  You can't just sit and read a book about programming; you need to do it yourself.  In this, the author succeeds wonderfully.  The exercises he suggests (under the heading &quot;A Few Things to Try&quot;) are geared toward putting the concepts you've just read about directly into practice.  And they're straightforward enough that, instead of thinking &quot;oh great, another programming exercise,&quot; you'll be thinking &quot;hey, that sounds easy enough,&quot; and you'll dive right in.

&lt;p&gt;

Even better, they're &lt;i&gt;fun&lt;/i&gt;.  No lame &quot;Hello, world&quot; or farenheit-to-celsius converters here.  (Oops, I think I just insulted K &amp; R.)  Instead you'll find such gems as

&lt;ul&gt;
    &lt;li&gt;An &quot;Angry Boss&quot; program, which rudely asks you what you want, then yells and fires you.
    &lt;li&gt;Generating .m3u playlists for use in WinAmp
    &lt;li&gt;99 Bottles of Beer on the Wall
&lt;/ul&gt;

The example programs are great, too.  A psychology student who's dying to found out whether you wet the bed as a child?  An algorithm from the game &lt;i&gt;Civilization III&lt;/i&gt;?  A baby dragon?  &lt;i&gt;Heh.  Baby dragons.&lt;/i&gt;  If you're looking to pick up Ruby, this is a fun way to get started.

&lt;p&gt;

Oh, and my impressions of Ruby now that I've written a few short programs?  It's kind of a nice language.  You can slurp the contents of a file in a single line.  It switches seamlessly between fixed-sized integer types and &quot;big&quot; integers.  (As it turns out, so does Python, but I'd never seen it before).  YAML is nicer than Perl's &lt;tt&gt;Data::Dumper&lt;/tt&gt;.  I like that you can add easily add methods to built-in classes, even if it's probably a bad idea -- being able to type &lt;tt&gt;3.factorial&lt;/tt&gt; is coool.

&lt;p&gt;

Ruby strikes me as being sort of like Python, if Python had been written by someone who liked Perl.  I don't think, though, that it goes the other way: Ruby is not sorta like Perl.  It just has enough Perl-ish bits to make the transition less painful.

&lt;p&gt;

I'm having trouble deciding on my next Ruby book.  I'm leaning toward the Pickaxe Book, but &lt;a href=&quot;http://www.manning.com/black/&quot;&gt;Ruby for Rails&lt;/a&gt; looks good, too.  After all, that's why I was planning to learn Ruby in the first place.

&lt;p&gt;

By the way, &lt;a href=&quot;http://www.kenytt.net/src/ruby&quot;&gt;click here&lt;/a&gt; for some bits of Ruby code.  Nothing spectacular, but they're sitting here on my hard drive -- no point in not sharing them.
</description>
  </item>
  <item>
    <title>Compiling Fl-Inventor on Windows</title>
    <link>http://www.kenytt.net/spool/2006/06/14#1150327573</link>
    <description>
Another option for Open Inventor programming on Windows is the Fl-Inventor library.  Here's how I got it to build:

&lt;ol&gt;

&lt;li&gt;Download the latest version of FLTK 1.1 from &lt;a href=&quot;http://www.fltk.org/&quot;&gt;http://www.fltk.org/&lt;/a&gt;.  At the time of this writing, the latest is &lt;tt&gt;fltk-1.1.7-source.zip&lt;/tt&gt;
&lt;li&gt;Unzip somewhere convenient, say &lt;tt&gt;C:\fltk-1.1.7&lt;/tt&gt;
&lt;li&gt;Open &lt;tt&gt;visualc\fltkdll.dsw&lt;/tt&gt; with Visual Studio.  (I'm using 6.0.  If you're using a later version, your mileage may vary.)
&lt;li&gt;Choose &lt;b&gt;Build&lt;/b&gt;, &lt;b&gt;Set Active Configuration...&lt;/b&gt; and choose &lt;b&gt;fltkdll - Win32 Release&lt;/b&gt;
    &lt;p align=&quot;center&quot;&gt;&lt;img src=&quot;/images/fl-inventor/fltkdll.png&quot;&gt;&lt;/p&gt;
&lt;li&gt;Choose &lt;b&gt;Build&lt;/b&gt;, &lt;b&gt;Build fltkdll.dll&lt;/b&gt;.
&lt;li&gt;Download and install an older version of &lt;a href=&quot;http://www.cmake.org/&quot;&gt;CMake&lt;/a&gt; from &lt;a href=&quot;http://www.cmake.org/files/&quot;&gt;http://www.cmake.org/files/&lt;/a&gt;.  (The latest version won't work without change, and the last thing I need to learn is a new build tool.)  I used &lt;tt&gt;CMSetup14.exe&lt;/tt&gt;.
&lt;li&gt;Download &lt;tt&gt;fliv-1.0.1.tar.gz&lt;/tt&gt; and &lt;tt&gt;oiv_linux_w32-4.tar.gz&lt;/tt&gt; from &lt;a href=&quot;http://fl-inventor.sourceforge.net/&quot;&gt;http://fl-inventor.sourceforge.net/&lt;/a&gt;.  Unzip them both into the same place.
&lt;li&gt;Change to &lt;tt&gt;C:\fl-inventor&lt;/tt&gt; and type &quot;&lt;tt&gt;cmake .&lt;/tt&gt;&quot;
&lt;li&gt;Back in Visual Studio, open &lt;tt&gt;FLINV_ALL.dsw&lt;/tt&gt;
&lt;li&gt;Set the Active Project Configuration to &quot;ALL_BUILD - Win32 Release&quot;.
    &lt;p align=&quot;center&quot;&gt;&lt;img src=&quot;/images/fl-inventor/ALL_BUILD.png&quot;&gt;&lt;/p&gt;
&lt;li&gt;Choose &lt;b&gt;Project&lt;/b&gt;, &lt;b&gt;Settings...&lt;/b&gt;.  &lt;b&gt;Settings For:&lt;/b&gt; should be set to &quot;Win32 Release&quot;, and all sub-projects should be selected.
&lt;li&gt;Holding down the Ctrl key, de-select &lt;b&gt;ALL_BUILD&lt;/b&gt;.  Some more tabs should appear to the right.  Select the &lt;b&gt;C++&lt;/b&gt; tab, and change &lt;b&gt;Category:&lt;/b&gt; to &quot;Preprocessor&quot;.  Under &lt;b&gt;Additional include directories:&lt;/b&gt;, add &lt;tt&gt;C:\fltk-1.1.7&lt;/tt&gt;.
    &lt;p align=&quot;center&quot;&gt;&lt;img align=&quot;center&quot; src=&quot;/images/fl-inventor/include-directories.png&quot;&gt;&lt;/p&gt;
&lt;li&gt;Holding down the Ctrl key again, de-select &lt;b&gt;FL&lt;/b&gt;, &lt;b&gt;FreeType2&lt;/b&gt;, and &lt;b&gt;Jpeg&lt;/b&gt;.  A &lt;b&gt;Link&lt;/b&gt; tab should appear to the right.  Select it and Change the &lt;b&gt;Category:&lt;/b&gt; to &quot;Input&quot;.  Under &lt;b&gt;Additional library path:&lt;/b&gt;, add &lt;tt&gt;C:\fltk-1.1.7\test&lt;/tt&gt;.  Click &lt;b&gt;Ok&lt;/b&gt;
    &lt;p align=&quot;center&quot;&gt;&lt;img align=&quot;center&quot; src=&quot;/images/fl-inventor/library-path.png&quot;&gt;&lt;/p&gt;
&lt;li&gt;Choose &lt;b&gt;Build&lt;/b&gt;, &lt;b&gt;Build&lt;/b&gt;.  The build will take several minutes.
&lt;li&gt;Exit Visual Studio.  You should be able to run the example programs from &lt;tt&gt;C:\fl-inventor\install\bin&lt;/tt&gt;
&lt;/ol&gt;
</description>
  </item>
  <item>
    <title>Open Inventor on Windows</title>
    <link>http://www.kenytt.net/spool/2006/06/14#1150314972</link>
    <description>
The &lt;a href=&quot;http://oss.sgi.com/projects/inventor/&quot;&gt;Open Source version of SGI Open Inventor&lt;/a&gt; is Linux-specific, and while it probably ports easily enough to other UNIX platforms, it doesn't look like a very attractive option for Windows.

&lt;p&gt;

If you want to do Open Inventor programming on Windows, the options seem to be:

&lt;ol&gt;
    &lt;li&gt;&lt;a href=&quot;http://www.tgs.com/&quot;&gt;TGS&lt;/a&gt; Open Inventor, a commercial product
    &lt;li&gt;&lt;a href=&quot;http://www.coin3d.org/&quot;&gt;Coin3D&lt;/a&gt;, a GPL clone of Open Inventor
        &lt;li&gt;a &lt;a href=&quot;http://studierstube.icg.tu-graz.ac.at/openinventor/&quot;&gt;Win32 port&lt;/a&gt; of the Open Source SGI Open Inventor that requires the SoQt library from Coin3D
&lt;/ol&gt;

Coin3D is probably the best choice, but it seems to include only the OI libraries, not the OI command-line tools like &lt;tt&gt;ivview&lt;/tt&gt; and &lt;tt&gt;ivnorm&lt;/tt&gt;.

&lt;p&gt;

Alternatively, the Win32 port of Open Inventor does incldue pre-compiled DLLs of Inventor, but not of the SoQt library or command-line tools.

&lt;p&gt;

I'm honestly not sure what the best solution is.  I'll post some instructions when I come up with something.
</description>
  </item>
  <item>
    <title>Minimal Ray Tracer</title>
    <link>http://www.kenytt.net/spool/2006/05/19#1148080957</link>
    <description>
Some &lt;a href=&quot;/courses/csuf/2006/spring/465/download/minray.zip&quot;&gt;code&lt;/a&gt; to accompany tonight's lecture: a version of &lt;a href=&quot;http://www.cs.cmu.edu/~ph/&quot;&gt;Paul Heckbert&lt;/a&gt;'s Minimal Ray Tracer from &lt;a href=&quot;http://www.cs.cmu.edu/~ph/gem4.html&quot;&gt;Graphics Gems IV&lt;/a&gt;.

&lt;p&gt;

I've updated the code to do the following:
&lt;ul&gt;
    &lt;li&gt;compile with GNU C
    &lt;li&gt;output &lt;a href=&quot;http://netpbm.sourceforge.net/doc/ppm.html&quot;&gt;plain PPM&lt;/a&gt;
    &lt;li&gt;generate a 1024 by 1024 image instead of the tiny 32-pixel original
&lt;/ul&gt;

I've also included a JPEG version of the image, generated with &lt;code&gt;ppmtojpeg&lt;/code&gt;, 

&lt;p&gt;

If you want to experiment with changing the scene defined in &lt;code&gt;ray.h&lt;/code&gt;, you'll probably want to download &lt;a href=&quot;http://gnuwin32.sourceforge.net/packages/netpbm.htm&quot;&gt;NetPbm for Windows&lt;/a&gt;.

</description>
  </item>
  <item>
    <title>Assignment 10</title>
    <link>http://www.kenytt.net/spool/2006/05/13#1147571517</link>
    <description>
If you didn't finish &lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst10&quot;&gt;Assignment 10&lt;/a&gt;, you can download &lt;a href=&quot;/courses/csuf/2006/spring/465/code/assignment10.c&quot;&gt;assignment10.c&lt;/a&gt; as a starting point for &lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst11&quot;&gt;Assignment 11&lt;/a&gt;.
</description>
  </item>
  <item>
    <title>Demos for tonight's lecture</title>
    <link>http://www.kenytt.net/spool/2006/05/12#1147478041</link>
    <description>
There are two demonstration program for tonight's lecture:
&lt;ul&gt;
    &lt;li&gt;&lt;a href=&quot;/courses/csuf/2006/spring/465/code/shading.c&quot;&gt;shading.c&lt;/a&gt;
    &lt;li&gt;&lt;a href=&quot;/courses/csuf/2006/spring/465/code/texture.c&quot;&gt;texture.c&lt;/a&gt;
&lt;/ul&gt;

You will need the texture mapping technique for &lt;a
href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst11&quot;&gt;Assignment
11&lt;/a&gt;.

&lt;p&gt;
</description>
  </item>
  <item>
    <title>Pixar's On-line Library</title>
    <link>http://www.kenytt.net/spool/2006/05/12#1147479360</link>
    <description>
I happened across this the other day: &lt;a href=&quot;http://www.pixar.com/&quot;&gt;Pixar&lt;/a&gt; has made available an &lt;a href=&quot;http://graphics.pixar.com/&quot;&gt;On-line library&lt;/a&gt; of technical papers.  Many of them are probably a bit advanced, but worth a look if you're considering further study.
</description>
  </item>
  <item>
    <title>Is this &lt;hint&gt;normal&lt;/hint&gt; behavior?</title>
    <link>http://www.kenytt.net/spool/2006/05/10#1147238663</link>
    <description>
Have you noticed that the lighting calculations don't seem to be affecting your windshield the same way they affect the rest of the car?

&lt;p&gt;

I wonder which part of the illumination equation isn't being evaluated &lt;hint&gt;normally&lt;/hint&gt;.
</description>
  </item>
  <item>
    <title>Material Colors</title>
    <link>http://www.kenytt.net/spool/2006/05/10#1147238273</link>
    <description>
Here's a function to set the current drawing color, whether or not lighting is enabled:

&lt;pre&gt;
    void color(double r, double g, double b)
    {
        float color[4] = { r, g, b, 1.0 };

        if (glIsEnabled(GL_LIGHTING)) {
            glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
        } else {
            glColor3f(r, g, b);
        }
    }
&lt;/pre&gt;

Note that although the color can be set for &lt;code&gt;GL_AMBIENT&lt;/code&gt; and &lt;code&gt;GL_DIFFUSE&lt;/code&gt; separately, you'll usually want them to be the same.

&lt;p&gt;

Alternatively, you could try &lt;a href=&quot;http://www.rush3d.com/reference/opengl-redbook-1.1/chapter06.html&quot;&gt;reading&lt;/a&gt; about &lt;code&gt;GL_COLOR_MATERIAL&lt;/code&gt;.
</description>
  </item>
  <item>
    <title>Chapter mismatch between HTML and PDF versions of the Red Book</title>
    <link>http://www.kenytt.net/spool/2006/05/05#1146863523</link>
    <description>
&lt;A After receiving a couple of questions about NURBS, I took a closer look at the &lt;a href=&quot;http://www.rush3d.com/reference/opengl-redbook-1.1/&quot;&gt;HTML&lt;/a&gt; and &lt;a href=&quot;http://www.gamedev.net/download/redbook.pdf&quot;&gt;PDF&lt;/a&gt; versions of the Red Book -- they're different editions, with different Chapter divisions.  The &lt;a href=&quot;http://www.rush3d.com/reference/opengl-redbook-1.1/chapter12.html&quot;&gt;Chapter 12&lt;/a&gt; you want is &quot;Selection and Feedback&quot;, not &quot;Evaluators and NURBS.&quot;  The next chapter, &quot;Lighting&quot;, has the same problem.
</description>
  </item>
  <item>
    <title>Assignment 9</title>
    <link>http://www.kenytt.net/spool/2006/04/28#1146234512</link>
    <description>
&lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst9&quot;&gt;Assignment 9&lt;/a&gt; is available.  Trust me -- the assignment will be easier if you attend class and implement the version of the algorithm that we discuss.
</description>
  </item>
  <item>
    <title>Slides for tonight's lecture</title>
    <link>http://www.kenytt.net/spool/2006/04/14#1145045208</link>
    <description>
For the second half of tonight's lecture, we'll be looking at the &lt;a href=&quot;http://www.siggraph.org/education/curriculum/projects/slide_sets/slides93/01_93_2.htm&quot;&gt;Aliasing and Antialiasing&lt;/a&gt; slides in the ACM SIGGRAPH &lt;a href=&quot;http://www.siggraph.org/education/curriculum/projects/slide_sets/slides93/slides93.htm&quot;&gt;1993 Education Slide Set&lt;/a&gt;.  There are some visual effects here that I couldn't draw on a whiteboard to save my life.
</description>
  </item>
  <item>
    <title>A note on doing the work yourself</title>
    <link>http://www.kenytt.net/spool/2006/04/14#1145042335</link>
    <description>
I realize that in &lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst6&quot;&gt;Assignment 6&lt;/a&gt; and &lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst7&quot;&gt;Assignment 7&lt;/a&gt; where we deal with well-known algorithms, it will be especially tempting to use someone else's implementation -- they are, after all, readily available on &lt;a href=&quot;http://www.google.com/search?q=bresenham+filetype%3Ac&quot;&gt;teh interwebs&lt;/a&gt;.

&lt;p&gt;

Note, however, the following:

&lt;ol&gt;
    &lt;li&gt;Turning in code you didn't write yourself is Academic Dishonesty.
    &lt;li&gt;Using someone else's pseudocode is fine, as long as you credit the source.
    &lt;li&gt;If you do use someone else's pseudocode, make sure you understand what it does.
    &lt;li&gt;There will be at least one question on each algorithm on the Final Exam.
    &lt;li&gt;If you take the time to implement the algorithm yourself, you will be more likely to remember it well enough to earn full credit on the exam.
&lt;/ol&gt;

Remember also that if you are struggling with an algorithm, you are allowed to work on homework assignments with a partner.

&lt;p&gt;

&lt;i&gt;Hint&lt;/i&gt;: pick a partner who's smarter than you are.
</description>
  </item>
  <item>
    <title>Announcements</title>
    <link>http://www.kenytt.net/spool/2006/04/07#1144447550</link>
    <description>
&lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst6&quot;&gt;Assignment 6&lt;/a&gt; is available.  

&lt;p&gt;

Note the updated office hours shown to the left: I've been able to rearrange my work schedule in order to be available before class.  Be sure to drop by and visit.
</description>
  </item>
  <item>
    <title>GLIntercept</title>
    <link>http://www.kenytt.net/spool/2006/03/31#1143853805</link>
    <description>
Here's a cool debugging tool for OpenGL on Windows: &lt;a href=&quot;http://glintercept.nutty.org/&quot;&gt;GLIntercept&lt;/a&gt;.  You can use it to track every OpenGL function call along with its parameters.  (For those of you familiar with UNIX, this is like &lt;tt&gt;truss&lt;/tt&gt;(1) or &lt;tt&gt;strace&lt;/tt&gt;(1), only for OpenGL calls instead of system calls.)

&lt;p&gt;

Here's a 30-second walkthrough:
&lt;ol&gt;
    &lt;li&gt;Download and run the Windows &lt;a href=&quot;http://glintercept.nutty.org/download.html&quot;&gt;installer&lt;/a&gt;.  You'll end up with a new directory, &lt;tt&gt;C:\Program Files\GLIntercept0_5&lt;/tt&gt;.
    &lt;li&gt;Copy &lt;tt&gt;OpenGL32.dll&lt;/tt&gt; and &lt;tt&gt;gliConfig_FullDebug.ini&lt;/tt&gt; to the same directory as your program.  Rename &lt;tt&gt;gliConfig_FullDebug.ini&lt;/tt&gt; to &lt;tt&gt;gliConfig.ini&lt;/tt&gt;
    &lt;li&gt;Run your program.  A new file will be created in the same directory called &lt;tt&gt;gliInterceptLog.txt&lt;/tt&gt;, containing every OpenGL call your program makes.  (You may also find that your program is a little slower).
&lt;/ol&gt;

Here's some of the output from running &lt;a href=&quot;/courses/csuf/2006/spring/465/code/assignment5.c&quot;&gt;assignment5.c&lt;/a&gt;:

&lt;pre&gt;
    glClearColor(0.000000,0.000000,0.000000,0.000000)
    wglGetCurrentContext()=0x10000
    wglGetCurrentDC()=0xb70114f8
    wglGetCurrentContext()=0x10000
    wglGetCurrentDC()=0xb70114f8
    glViewport(0,0,600,300)
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    glOrtho(0.000000,2.000000,0.000000,1.000000,-1.000000,1.000000)
    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()
    glClear(GL_COLOR_BUFFER_BIT)
    glColor3f(1.000000,1.000000,0.000000)
    glBegin(GL_LINES)
    glVertex3f(1.000000,0.000000,0.000000)
    glVertex3f(1.000000,1.000000,0.000000)
    glEnd()
    glViewport(300,0,300,300)
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    glFrustum(-1.500000,1.500000,-1.500000,1.500000,2.000000,8.000000)
    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()
    glMultMatrixf([1.000000,0.000000,0.000000,0.000000,
                   0.000000,1.000000,0.000000,0.000000,
                   0.000000,0.000000,1.000000,0.000000,
                   0.000000,0.000000,0.000000,1.000000])
    glTranslated(0.000000,0.000000,-6.500000)
    glPushMatrix()
    glPushMatrix()
    glColor3f(1.000000,0.000000,0.000000)
    glBegin(GL_LINE_LOOP)
    glNormal3fv([0.000000,0.000000,-1.000000])
    glVertex3fv([0.500000,0.500000,-0.500000])
    glVertex3fv([0.500000,-0.500000,-0.500000])
    glVertex3fv([-0.500000,-0.500000,-0.500000])
    glVertex3fv([-0.500000,0.500000,-0.500000])
    glEnd()
&lt;/pre&gt;

Running with &lt;tt&gt;gliConfig_FullDebug.ini&lt;/tt&gt; also makes sure that every call to an OpenGL function is checked with &lt;tt&gt;glGetError()&lt;/tt&gt;, which will catch things like passing bad values to functions or trying to pop the matrix stack more times that it's been pushed.

&lt;p&gt;

To make the best use of a tool like this, you'll probably want a &lt;a href=&quot;http://unxutils.sourceforge.net/&quot;&gt;utility&lt;/a&gt; to &lt;a href=&quot;http://en.wikipedia.org/wiki/Tail_(Unix)&quot;&gt;tail&lt;/a&gt; the log as your program is running.  (I'm told there are also &lt;a href=&quot;http://www.makelogic.com/tail/TailHome.htm&quot;&gt;GUI versions&lt;/a&gt;).

&lt;p&gt;

Note that you don't need access to the source code -- if you have a game at home that uses OpenGL, you can &lt;a href=&quot;http://hacks.oreilly.com/pub/h/5235&quot;&gt;watch what it's doing&lt;/a&gt;, too.  (Just don't steal their code, and don't tell them I'm the one who told you how.)

&lt;p&gt;

GLIntercept has a few more tricks up its sleeve, but I'll leave it up to you to &lt;a href=&quot;http://glintercept.nutty.org/&quot;&gt;read about them&lt;/a&gt;.  For Linux people, there's a similar program called &lt;a href=&quot;http://bugle.sourceforge.net/&quot;&gt;BuGLe&lt;/a&gt;, but I haven't tried it.  And, of course, we smug OS X weenies have the &lt;a href=&quot;http://developer.apple.com/graphicsimaging/opengl/profiler_image.html&quot;&gt;OpenGL Profiler&lt;/a&gt;.

&lt;p&gt;

For those of you using &lt;a href=&quot;http://www.kenytt.net/spool/2006/02/11#1140057517&quot;&gt;Igloo&lt;/a&gt;, I've put together a new &lt;a href=&quot;/courses/csuf/2006/spring/465/download/igloo-debug.zip&quot;&gt;debug package&lt;/a&gt; that includes GLIntercept and Windows port of &lt;a href=&quot;http://www.gnu.org/software/coreutils/manual/html_chapter/coreutils_5.html#SEC19&quot;&gt;GNU tail&lt;/a&gt;.  I'm not entirely sure about the legality of all this -- GLIntercept and GNU tail are available under the GNU General Public license, but &lt;a href=&quot;http://eic.sourceforge.net/&quot;&gt;EiC&lt;/a&gt; is still MIA.
</description>
  </item>
  <item>
    <title>Why Microsoft is not my favorite software company</title>
    <link>http://www.kenytt.net/spool/2006/03/18#1142664344</link>
    <description>
The &lt;a href=&quot;/courses/csuf/2006/spring/465/grades.htm&quot;&gt;grade sheet&lt;/a&gt; that I posted a few minutes ago is rather hard to read in Internet Explorer.  It looks like the bottom few pixels of each row are cut off.

&lt;p&gt;

The HTML file was generated by setting a print area and choosing &lt;b&gt;Save As Web Page&lt;/b&gt; from the &lt;b&gt;File&lt;/b&gt; menu in Excel 2004 for Mac.

&lt;p&gt;

I understand cross-browser differences.  I even understand cross-platform differences.  But if I can't save a web page from the latest version of one Microsoft product and have it readable from the latest version of another Microsoft product, well...

&lt;p&gt;

You should all be using &lt;a href=&quot;http://www.mozilla.org/firefox/&quot;&gt;Mozilla Firefox&lt;/a&gt; anyway.  It looks fine there.

</description>
  </item>
  <item>
    <title>Homework Grades</title>
    <link>http://www.kenytt.net/spool/2006/03/18#1142664148</link>
    <description>
I've posted &lt;a href=&quot;/courses/csuf/2006/spring/465/grades.htm&quot;&gt;grades&lt;/a&gt; as of 10:41pm Friday 3/17.

&lt;p&gt;

If you turned in an assignment that isn't recorded, or if you didn't get as high a score on an assignment as you think you should have, please e-mail me.
</description>
  </item>
  <item>
    <title>Assignment 5</title>
    <link>http://www.kenytt.net/spool/2006/03/10#1142031490</link>
    <description>
&lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst5&quot;&gt;Assignment 5&lt;/a&gt; is available.  Note that this is the last assignment due before the Midterm Exam on March 24.</description>
  </item>
  <item>
    <title>Pop-quizzes and pedagogy</title>
    <link>http://www.kenytt.net/spool/2006/03/07#1141716495</link>
    <description>
A &lt;a href=&quot;http://www.eurekalert.org/pub_releases/2006-03/wuis-rtb030606.php&quot;&gt;study from Washington University in St. Louis&lt;/a&gt; finds that

&lt;blockquote&gt;
quizzes -- given early and often -- may be a student's best friend when it comes to understanding and retaining information for the long haul
&lt;/blockquote&gt;

&lt;i&gt;Say, that gives me an idea...&lt;/i&gt;</description>
  </item>
  <item>
    <title>Another schedule update</title>
    <link>http://www.kenytt.net/spool/2006/03/06#1141677658</link>
    <description>
Please note that I've updated the &lt;a href=&quot;/courses/csuf/2006/spring/465/outline.html&quot;&gt;Course Outline&lt;/a&gt; again.

&lt;p&gt;

For those of you wondering why I've been making changes to the schedule, I've taught the course two different ways in the past:

&lt;ol&gt;
	&lt;li&gt;As a lab course with weekly assignments
	&lt;li&gt;As a lecture course with 4 or 5 larger programming assignments
&lt;/ol&gt;

In courses of type &lt;i&gt;(1)&lt;/i&gt;, we cover the basic techniques of 3D graphics and you get a lot of experience implementing them.  In courses of type &lt;i&gt;(2)&lt;/i&gt; we talk about a broader range of topics, but for most of them you never get a chance to see the code.

&lt;p&gt;

I'd originally planned to teach this semester as a lecture course, but when it was scheduled for a single class meeting on Friday nights a couple of things became clear:

&lt;ol&gt;
	&lt;li&gt;The building would be nearly empty, and we could have our pick of labs
	&lt;li&gt;In a lecture course, everyone would be asleep  by 8:45
&lt;/ol&gt;

So I'm adjusting the outline as we go along.  I think we're on track for the rest of the semester, but don't be surprised if there's at least one more change before the end.
</description>
  </item>
  <item>
    <title>Vector Math Tutorial for 3D Computer Graphics</title>
    <link>http://www.kenytt.net/spool/2006/03/06#1141676909</link>
    <description>
If you need to brush up on your math before the midterm, the &lt;a href=&quot;http://chortle.ccsu.edu/VectorLessons/vectorIndex.html&quot;&gt;Vector Math for 3D Computer Graphics&lt;/a&gt; from the Computer Science department at Central Connecticut State University is a pretty good review.
</description>
  </item>
  <item>
    <title>A correction</title>
    <link>http://www.kenytt.net/spool/2006/03/06#1141674940</link>
    <description>
If you were paying attention over the weekend, you noticed that I updated the screenshot for &lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst4&quot;&gt;Assignment 4&lt;/a&gt;.

&lt;p&gt;

If you compare it with the &lt;a href=&quot;/courses/csuf/2006/spring/465/images/assignment4-bad.gif&quot;&gt;original screenshot&lt;/a&gt;, you'll notice that the original wasn't really a parallel projection.

&lt;p&gt;

The problem is that (as you should recall from your reading) OpenGL is a &lt;i&gt;state machine&lt;/i&gt;.  When you make a function call like &lt;code&gt;gluPerspective()&lt;/code&gt; to update the current projection matrix, that change stays in effect until you reset the matrix (e.g., with &lt;code&gt;glLoadIdentity()&lt;/code&gt;.

&lt;p&gt;

My mistake was to draw the parallel projections (calling &lt;code&gt;glOrtho()&lt;/code&gt;) without remembering to reset the projection matrix, which had already been set with &lt;code&gt;gluPerspective&lt;/code&gt;.  The result was that we took a cube in perspective, then drew a parallel projection of the perspective rendering.  &lt;i&gt;Oops&lt;/i&gt;.  I didn't notice because it looks &quot;sort of&quot; right -- there was, in fact, a parallel projection happening.

&lt;p&gt;

To avoid making silly mistakes like me, do the following whenever you go to render a model (e.g., in your display callback):

&lt;ol&gt;
	&lt;li&gt;Set the viewport.
		&lt;table border=&quot;1&quot; align=&quot;center&quot; cellpadding=&quot;5&quot; nowrap&gt;
			&lt;tr&gt;&lt;td&gt;&lt;code&gt;
				glViewport(0, 0, width, height);
			&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
		&lt;/table&gt;
	&lt;li&gt;Set up the projection.
		&lt;table border=&quot;1&quot; align=&quot;center&quot; cellpadding=&quot;5&quot; nowrap&gt;
			&lt;tr&gt;&lt;td&gt;&lt;code&gt;
				glMatrixMode(GL_PROJECTION);&lt;br&gt;
				glLoadIdentity();&lt;br&gt;
				glOrtho(-2.0, 2.0, -2.0, 2.0, 0.0, 10.0);
			&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
		&lt;/table&gt;
	&lt;li&gt;Set your viewing parameters.
		&lt;table border=&quot;1&quot; align=&quot;center&quot; cellpadding=&quot;5&quot; nowrap&gt;
			&lt;tr&gt;&lt;td&gt;&lt;code&gt;
				glMatrixMode(GL_MODELVIEW);&lt;br&gt;
				glLoadIdentity();&lt;br&gt;
				gluLookAt(0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
			&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
		&lt;/table&gt;
	&lt;li&gt;Draw the scene.
		&lt;table border=&quot;1&quot; align=&quot;center&quot; cellpadding=&quot;5&quot; nowrap&gt;
			&lt;tr&gt;&lt;td&gt;&lt;code&gt;
				glClearColor(0.0, 0.0, 0.0, 1.0);&lt;br&gt;
				glClear(GL_COLOR_BUFFER_BIT);&lt;br&gt;
				&lt;br&gt;
				glColor(0.0, 0.0, 1.0);&lt;br&gt;
				glutWireSphere(1.0, 10, 10);
			&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
		&lt;/table&gt;
&lt;/ol&gt;
</description>
  </item>
  <item>
    <title>Don't cross the streams</title>
    <link>http://www.kenytt.net/spool/2006/03/02#1141333869</link>
    <description>
If you're still working on &lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst3&quot;&gt;Assignment 3&lt;/a&gt;, note that the coordinate axes (the lines in gray) should not be moving when you transform the cube.  The axes should remain at the center of the world, not at the center of your model.

&lt;p&gt;

By the way, &lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst4&quot;&gt;Assignment 4&lt;/a&gt; is available.
</description>
  </item>
  <item>
    <title>Assignment 3</title>
    <link>http://www.kenytt.net/spool/2006/02/24#1140830283</link>
    <description>
&lt;a href=&quot;/courses/csuf/2006/spring/465/assignments.html#asst3&quot;&gt;Assignment 3&lt;/a&gt; is available.</description>
  </item>
  <item>
    <title>Best science headline ever</title>
    <link>http://www.kenytt.net/spool/2006/02/20#1140426744</link>
    <description>
From &lt;i&gt;New Scientist&lt;/i&gt;: &lt;a href=&quot;http://www.newscientist.com/channel/being-human/dn8742.html&quot;&gt;Hand waving boosts mathematics learning&lt;/a&gt;.

&lt;p&gt;

So don't complain when I do it in class: it's a pedagogical technique.

&lt;p&gt;

On a more serious note, blame computers for this one: &lt;a href=&quot;http://www.newscientist.com/article.ns?id=dn8743&amp;feedId=online-news_rss20&quot;&gt;Mathematical proofs getting harder to verify&lt;/a&gt;:

&lt;blockquote&gt;
&quot;Twenty-five years later we're still not sure if it's correct or not. We sort of think it is, but no one's ever written down the complete proof&quot; 
&lt;/blockquote&gt;
</description>
  </item>
  </channel>
</rss>
