None of these programs should use twCamera; you have to set up your own camera. Don't worry about the viewport or the reshape callback; assume that the window is always square.
Note that the mouse doesn't work for either program, because the camera is set up "by hand," rather than using twCamera().
Here's the goal:
~cs307/public_html/assignments/slides
For this part of assignment, I want you to use the wire barn (this makes the projection easier to see). I've just added this function to TW. You should use a barn that is 10 units wide, 20 units high and 30 units deep, with the reference point (lower left front corner) at the origin.
I want you to try to duplicate my camera shape and location as well as possible. In other words, try to analyze how things are projecting to see if you can reverse-engineer to set up a similar camera. That will help you when you are trying to achieve a particular look in your own scenes.
I'll make you some guarantees: all my numbers are nice integers, or simple calculations from nice integers. So, if you get close, you'll likely be exactly on. I also didn't modify the aspect ratio and the near and far are such that everything is visible. You only have to worry about the FOVY and the arguments to gluLookAt().
The FOVY may change from scene to scene!
My program defines the following keyboard callbacks and scenes; yours must too.
Here's the goal:
~cs307/public_html/assignments/flythrough
The idea is that you'll create N frames of an animation of a plane landing near the barn. I used a field of view of 90 degrees. Here I used N=6, assigned to keys 1-6, but if you find a pattern, you'll see that you can easily generate as many frames as you like. In fact, if you press the "+," mine will take you through 50 frames (from frame 1 to frame 6) in small steps. (You are not required to do this.)
A further insight is that hitting "2" twice is the same as hitting "3," and so forth. You reset to the first frame by hitting "1" but after that, any of the numbers 2-6 do the same thing. The reason for that is that, in my solution, the differences between the frames are all the same, so I could combine the code. You need not do that, but you may find it useful to realize that there is a systematic difference between frames.
(You may also notice that in my solution, you can go beyond the 6th frame and fly the plane through the ground. That's an unfortunate side-effect of the way I coded it.)
If you want to see a version without that flaw, run
~cs307/public_html/assignments/flythrough2
The better version allows you to backup and skip around in the set of frames.
The two versions are not precisely the same, but they are close enough for the purposes of this assignment. You can mimic either one.
Please read the standard instructions for all assignments
Please do the problems in this PDF file: math3.pdf
Written by Scott D. Anderson
scott.anderson@acm.org

This work is licensed under a Creative Commons
License.