CSE328: FUNDAMENTALS OF COMPUTER GRAPHICS (SPRING SEMESTER, 2007)

CSE328 ASSIGNMENT TWO (10% of the total course grade, 200 points in total are used for the grading scheme, due at 2:10pm on Wednesday, March 28, 2007)!

Please note that, the programming project will be graded based on: (1) code correctness, (2) efficiency of program execution, and (3) quality of programming codes (i.e., whether they are understandable)!

This programming project focuses on applying three dimensional graphics techniques to display and manipulate geometric shapes in common use such as cube, tetrahedron, sphere, cylinder, cone, torus, etc. Please write an OpenGL program that implements the drawing of polyhedral objects and quadrics primitives. Your program should be able to (1) display wireframe objects, (2) display flat-shaded solid objects, and (3) allow users to interactively translate and zoom the displayed objects. In particular, the entire project must consist of the following components as far as the system functionalities are concerned:

(a) (10 points) First refer to Figure 3-58 and Figure 3-59 (on Page 140) and read the contents on pages 140-141 in the book of Computer Graphics with OpenGL (our required textbook for the course). Second, display a cube object similar to the one illustrated in Figure 3-58 or Figure 3-59 of our textbook.

(b) (10 points) Display a tetrahedron object similar to the one illustrated in Figure 5-51 on page 276 of our textbook. 

(c) (30 points) (1) Carefully read the handout prepared by the instructor and fully understand its detailed technical contents (note that, the handout is a hardcopy of pages 95--102 from the book: OpenGL Programming Guide Fifth Edition: The Official Guide to Learning OpenGL, Version 2); (2) Pay special attention to Figure 2-17 in the handout; (3) (10 points) Based on OpenGL program examples documented in the handout, write a OpenGL program to display an icosahedron of the sphere (i.e., a 20-polygon representation of the sphere); (4) (10 points) Subdivide your icosahedron once and display an improved 80-triangle approximation of the sphere (please refer to Figure 2-17); (5) (10 points) Further subdivide your 80-triangle approximation of the sphere and display a 320-triangle approximation of the sphere (i.e., subdivide your icosahedron twice).

(d) (30 points) Read the second half of the handout (note that, it is a hardcopy of pages 515-524 in the book: OpenGL Programming Guide Fifth Edition: The Official Guide to Learning OpenGL, Version 2) and pay special attention to the drawing instructions of spheres and cylinders as well as the OpenGL program Example 11-4 on pages 521--524. Display a sphere, a cylinder, and a cone based on the program quadric.c shown in the handout.

(e) (60 points) Based on (c) explained above, generalize your sphere drawing program to display an ellipsoid. In particular, your new ellipsoid drawing program should be capable of displaying a 20-triangle approximation, a 80-triangle approximation, and a 320-triangle approximation for the same ellipsoid, in analogy to (c) (Hint: refer to Pages 408-409 in our textbook (Computer Graphics with OpenGL) for the parametric equation of an ellipsoid).

(f) (60 points). Based on the idea used to implement functionalities (a)--(e) above, draw a torus (Hint, refer to Pages 409-410 in the textbook for its parametric equation and use polygons to approximate the torus). Although you are free to select the number of polygons to be used to approximate the torus, I suggest that you sample a continuous torus using at least 9*9=81 different points in order to better approximate the torus. Note that, the display quality should be reasonably good!