CS 420 Computer Graphics


Lab 14
Dr. Tong Yu, Fall 2007

Clipping Planes

Login and open two windows, one for editing and one for compiling and executing programs.

  1. Copy the program clip.cpp from the lecture notes. Compile and execute it.

  2. What is the use of the statement glTranslatef (0.0, 0.0, -5.0); in dispaly() function? Comment this out and recompile your program. What do you see when you run it? Why?

  3. Now add the statement gluLookAt ( 0, 0, 5, 0, 0, 0, 0, 1, 0 ); after gluPerspective() at reshape() function. What do you see? What is the effect of gluLookAt() here?

  4. Comment out glEnable( CL_CLIP_PLANEi );. What do you see?

  5. Now, restore your program and try changing the coefficients that describe the clipping planes.

  6. Try calling a modeling transformation, such as glRotate*(), to affect glClipPlane(). Make the clipping plane move independently of the objects in the scene.

    Extra Credits

      ( EC 0.2 )
      Draw a solid sphere with radius 1.0 at the center of the screen ( you may use glutSolidSphere() ). Clip the sphere with the plane at x = 0.5.

      (EC 0.1 )
      Rotate your clipping plane around the y-axis.