EXERCISES FOR Week 7
week7-1

Copy the file /classes/cs3014/files/Transformations/ortho_demo.cpp to your directory. In the init function, comment out the three lines of code that sets the viewer. This results in the default viewing position. What are the default values for gluLookAt? Compile and run the program. Explain what you see.

week7-2

Again working with ortho_demo.cpp, make changes to the parameters in gluLookAt and rerun the program each time. Make sure you can explain what you see.   In order to make the display more meaningful, change the cube to a teapot.   Especially make changes so that you can view the teapot

  • from the front
  • from the right side
  • from the top


Use the keyboard to allow you to make the various changes:

  • f:  front view
  • t:  top view
  • r:  right view
  • c:  original "corner" view
This is not a trivial problem;  you need to think about when the call will be made to gluLookAt.

Save the program as ortho_teapot.cpp.

week7-3

Make a change to ortho_teapot.cpp so that the three axes are drawn as part of the display. Choose three different colors for the axes and display only the positive portion of each axis. The length does not matter, as long as they are the same length and they extend beyond the teapot.

Add code so that the 'x' key toggles the axes on and off.

week7-4

Still working with ortho_teapot.cpp, l

  • What is the call to rotate 30 degrees counter clockwise with respect to the x-axis?  Try it.
  • What is the call to rotate 60 degrees clockwise with respect to the x-axis?  Try it.
  • What is the call to rotate 90 degrees counter clockwise with respect to the y-axis?  Try it.
  • What is the call to rotate -20 degrees counter clockwise with respect to the z-axis?  Try it.
  • What is the call to rotate 20 degrees clockwise with respect to the z-axis?  Try it.