CIS 736 (Computer Graphics)

Spring, 2001

 

Machine Problem 2

 

Saturday, February 3, 2001

Due: Friday, February 23, 2001 (by midnight)

 

This machine problem is designed to introduce you to the OpenGL graphics programming library and help start using it for rendering and camera animation.

 

Refer to the course intro handout for guidelines on working with other students.  Remember to submit your solutions in electronic form using handin and produce them only from your own work (not common scratch work, notes, or sources other than the OpenGL library).  If you intend to use other references (e.g., A. Watt’s books or Graphics Gems), get the instructor’s permission, and cite your reference properly.

 

1.        (5 points) Drawing a simple 2D scene.  Construct a simple 2D scene, in color, containing at least the following primitives:

-          Circles or ellipses

-          Irregular polylines

-          Irregular polygons

-          Regular polygons

and render it using an OpenGL program (you may write this in C or C++).  For example, draw a side-view orthographic projection of your car.

Submit a file titled mp2-1.c containing the source code that produces the final scene (this source should compile to a binary that will be executed with no command line arguments, i.e., mp2-1) and a README2-1 file documenting your rendering code and the basic GL functions that you used.

 

2.        (15 points total) Drawing a simple 3D scene and using the matrix stack.  Construct a simple 3D scene such as the house in Chapter 6 of FVD and apply the following projections using OpenGL:

 

-          (5 points) Parallel

·         Top, side, and front view orthographic

·         Cavalier

-          (10 points) Perspective

·         1-point

·         3-point

 

Submit the source code that produces the projections, your scene file (titled scene2-2) in the standard scene file format (to be posted), and a README2-2 file.  Your program must be titled mp2-2.c and, when compiled with OpenGL, will be invoked with 2 command-line arguments (mp2-2 n scenefile):

 

  1. top-view
  2. side-view
  3. front-view
  4. cavalier
  5. 1-point perspective
  6. 3-point perspective

 

3.        (30 points) “Flying through” a simple 3D scene.  In this machine problem, you will design and implement two “camera tracks” to display a fly-through animation of the 3D scene from Problem 2.

 

a)       (5 points) Draw a 3D wireframe scene with 2 connected components (2 cubes or 2 houses, for example).  You may reuse single objects from Problem 2.

b)       (25 points) Implement a Bézier curve that flies through this scene, subject to the following view specification:

-          Both components of the scene should be visible for part of the animation.

-          In part of the animation, one of the components should partially occlude the other. You do not have to perform visible surface determination for this machine problem.

-          The camera (eyepoint) should pass through one of the components.

To complete this problem, you need to:

-          Write down the appropriate control polygon endpoints in world coordinates for the scene you drew in part (a).

-          Use either the OpenGL Bézier code or deCasteljau’s algorithm (as specified in Section 11.2.7 of Foley et al) to interpolate each segment of the curve.

 

At each interpolated point, call gluLookAt() to update the view.  When your interpolation granularity is fine enough, you should get a smooth animation.

 

Your programs must be titled mp2-3a.c and mp2-3b.c. When compiled with OpenGL, they will be invoked with 1 command-line argument (mp2-3a scenefile, mp2-3b scenefile) to produce the animations in a window.  Submit your sources, scene2-3a, and a README2-3 file.

 

You should be running handin with a total of 9 files for this MP.