Prof Avery's weblog
jagged junkpile of jocularity
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:
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.
- As a lab course with weekly assignments
- As a lecture course with 4 or 5 larger programming assignments
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:
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.
- The building would be nearly empty, and we could have our pick of labs
- In a lecture course, everyone would be asleep by 8:45
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.
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
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):
- Set the viewport.
glViewport(0, 0, width, height);
- Set up the projection.
glOrtho(-2.0, 2.0, -2.0, 2.0, 0.0, 10.0);
- Set your viewing parameters.
gluLookAt(0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
- Draw the scene.
glClearColor(0.0, 0.0, 0.0, 1.0);
glColor(0.0, 0.0, 1.0);
glutWireSphere(1.0, 10, 10);