OpenGL Lab: Combinations of Transformations
CS 320
Mar 2, 2001
In this lab, you'll use combinations of OpenGL transformations to move a
small house around a 2-D world. Please don't damage the house --- it's my
home.
- Create a new OpenGL project, grab
transform.c
from the class
homepage, and add it to the project.
- Compile and run the program. Notice the three elements of the
program: coordinate axes in white, point at (4, 3) showing the center of
the house in green, and the house itself in red. The axes and point are
rendered using the
background
display and the house is rendered
using the house
display list.
Consider the center point fixed --- no need to move it around.
-
main()
registers display()
as the display callback.
You can find display()
at the end of the source file. Within
display
, you'll see the juncture at which you add your
transformation calls.
- Modify
display()
to effect each of the following
transformations on the house, one at a time:
- Rotate the house CCW about its center.
- Rotate the house CW about the apex of its roof.
- Scale the house by about its center.
- Position the house so that its center point is 6 units from the
origin at an angle of and the house itself is upright.
- Position the house so that its center point is 6 units from the
origin at an angle of and the house itself is tilted at an
angle of CCW.
- Without using translation, move the house into the second quadrant
(I hear the grass is greener there.).
Thomas P. Kelliher
Fri Mar 2 09:51:12 EST 2001
Tom Kelliher