/var/spool/weblog
   


Prof Avery's weblog
mirth-tinged monotony

<spool@kenytt.net>

CSU Fullerton Perl Powered Python vi Hacker

Geek News

del.icio.us bookmarks

RSS


       
Mon, Mar 06, 2006

Another schedule update
Please note that I've updated the Course Outline again.

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:

  1. As a lab course with weekly assignments
  2. As a lecture course with 4 or 5 larger programming assignments
In courses of type (1), we cover the basic techniques of 3D graphics and you get a lot of experience implementing them. In courses of type (2) we talk about a broader range of topics, but for most of them you never get a chance to see the code.

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:

  1. The building would be nearly empty, and we could have our pick of labs
  2. In a lecture course, everyone would be asleep by 8:45
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.

/var/spool/courses/csuf/2006/spring/cpsc465 #

Vector Math Tutorial for 3D Computer Graphics
If you need to brush up on your math before the midterm, the Vector Math for 3D Computer Graphics from the Computer Science department at Central Connecticut State University is a pretty good review.

/var/spool/courses/csuf/2006/spring/cpsc465 #

A correction
If you were paying attention over the weekend, you noticed that I updated the screenshot for Assignment 4.

If you compare it with the original screenshot, you'll notice that the original wasn't really a parallel projection.

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

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

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

  1. Set the viewport.
    glViewport(0, 0, width, height);
  2. Set up the projection.
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-2.0, 2.0, -2.0, 2.0, 0.0, 10.0);
  3. Set your viewing parameters.
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluLookAt(0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
  4. Draw the scene.
    glClearColor(0.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glColor(0.0, 0.0, 1.0);
    glutWireSphere(1.0, 10, 10);

/var/spool/courses/csuf/2006/spring/cpsc465 #


       

 

December 2017
Sun Mon Tue Wed Thu Fri Sat
         
           

RSS

Topics


Archives