Math 155A - Introduction to Computer Graphics - Spring 2005
Instructor: Sam Buss,  Univ. of California, San Diego

Project #3 - Build a 3D wire-frame scene.

You will build a 3-D scene in wireframe mode.  It will contain (a) a surface of rotation in the shape of a sombrero, (b) some geometric shapes based on the initial of your name (either first or last name), and (c) will incorporate animation.    This project #3 will be the basis for the subsequent project #4 that adds material properties and lights to your scene.

Due Date: Wednesday, May 4, midnight.

Goals: Learn how to create a parametric surface (namely, a portion of an surface of rotation) using quad strips and triangle fans or strips.  Learn how to model simple scenes with the supplied GLUT shapes such as spheres, cones, etc.  Find out culling of back faces works.  Find out how to toggle wireframe mode.   Discover that wireframe objects, especially when combined with animation can look very three dimensional.  Discover, however, that flat, solidly colored objects look much too flat and non-three-dimensional.

What to hand in: 
Make a directory called WireFrameScene in your Math 155A  home directory.  (The Math 155A storage directory on ieng9, under Class Resources, not your "My Documents" folder).  The file modification dates will serve as a time stamp so we will know files have been turned in on time.   Place, in that directory, all your source files and project files (including .vcproj and .sln files). Also place there a screenshot of your scene.
    (2) You must upload
also, a thumbnail GIF file, a full size screenshot and a very simple HTML file using a web page described below.  This will collect the entire class's projects into a web page that will be made accessible on the web.
As usual, grading will be personalized and one-on-one with Jefferson Ng or with Sam Buss.  Your program must run on the PC lab, you must come into the PC lab and meet one of us.  You will have to show your source code, run the program, possibly make changes on the spot to your program and recompile as requested by the grader, and be able to explain how your program works and why it renders what it does. Your files should be complete and project must recompile in the ieng9 directory.   You will then come see a TA to get your work graded.  This grading MUST be done within one week of the due date.


1. Download the file from the web.  This zip file contains four files:  (1&2) C++ source files WireFrameScene.cpp and WireFrameScene.h,   (3) an executable WireFrameSceneDemo.exe,  and  (4) a  template index.html file for later turning-in. 
    Run the executable file on a PC.  You will see a scene with a surface of rotation and a letter "S".  (That's my initial.).  Note the following commands act on the scene:

Your job is to re-create this program -- sort of!!.  You will re-create the surface of revolution exactly, and form something creative based on your own first initial instead of the "S".   You will also supply some animation.

2. Form a new project and workspace.  Include the two source files in it.   The supplied source code handles all the keystroke commands, and draws the flat base plane, and a sphere that marks the position of the surface of rotation.   It has empty routines that will be used to form the surface of rotation and the geometry based on your initials.    For information on how to build a new project, read this handout on starting a new Visual Studio.NET C++ project.

3. Rewrite the code that generates the surface of rotation.  The surface is a surface of rotation from from the sin(x)/x curve for  0 x ≤ 3π, that is, x in [0,3π]You should scale and position the surface of rotation so that it looks approximately like the one in the supplied executable.  We will discuss in class more details on how to form this surface!
    You should use quad strips and/or triangle strips  and/or triangle fans to build the surface of rotation.

4. Design some geometric shapes that are based (*loosely* based is OK) on the first initial of your first name.  Do something creative so no two of you have the same geometry.  Suggestions: use the glutSolid objects, such as spheres, cones, dodecahedra, tori, etc. to build your objects.   The course web page has pointers to GLUT documentation that describes how to call these routines.  The glutSolid... objects will be automatically rendered in wireframe mode when wireframe mode is activated.  You may also use quad strips, triangle fans, etc. if you wish.  The geometric shapes should be solid (i.e., they should not consist of points and lines). 
    If you wish to use cylinders: GLUT does not supply a cylinder drawing routine, but you can find a substitute on the textbook's web page under OpenGL software.

5. Animate some portion of your geometry.  In the supplied code, note that the top piece of the "S" is animated half the time and stationary half the time.  You will need to call glutPostRedisplay() at the right time in order to make the animation run.   (You can see where this is done in the Solar program.  You should understand what this call is achieving.) 
    Your sin(x)/x surface should be well-formed:
It should not have missing quads or triangles.  It should not have quads or triangles that are drawn twice.  It should not have pixel-sized misalignments due to for floating point roundoff error.  For tips on avoiding floating point roundoff error see the PDF file:  Advice on controlling your loops for the surface of revolution.

6. Leave the base plane the same as it is in the supplied code.  Your finished program should look the same as the supplied demo executable, except the "S" is replaced by your own creation and with animation of your own design.

7 Make a screen shot and a thumbnail gif, then turn everything in.  Here is a page with detailed turn-in instructions.

Grading is on a scale of 1-10.