CPSC 324, Spring 2004
Lab 7: OpenGL 3D Modeling


THIS IS OUR FIRST LAB on 3D graphics programming in OpenGL. The lab concentrates on modeling transformations. We will not use 3D lighting and materials in this lab. The objects that you draw will be wireframe models. Wireframe objects actually look better without lighting.

You will need a copy of the file open_gl_wireframe_starter.cc, which you can copy from the directory /home/cs324. We looked at this program in class. You probably want to rename the file. Remember that to compile a program that uses OpenGL commands, you should use the "mesacomp" command. For example:

         mesacomp  -o car  open_gl_wireframe_starter.cc

This program shows a very simple wireframe car with the word "CAR" behind it. You can rotate the scene using the arrow keys and the Home key. If you press the "A" key, an animation will start, showing the car tumbling in space. Stop the animation by pressing the "A" key again.

Exercise: The exercise for the lab is to modify the program open_gl_wireframe_starter.cc to make it draw a different object. Your object should be made up of at least six sub-objects. It should not be a car or anything too similar. You could, for example, make a four-legged table with a teapot on top. Or make an airplane with body, wings, wheels, and propellor. You can do this work entirely inside the drawObjects() function (unless you decide that you need to change the projection or viewing transformations). Furthermore, you should modify the animation that is done by the program. Instead of tumbling the object as a whole, the animation should show parts of the object moving within the object. For example, you could have objects sliding around on top of the table, or you could make the airplane wings flap or the propellor rotate. Please turn in a printout of your program next Wednesday, and post two screenshots from your program, showing the object in two different views.

Here, by the way, is a list of the GLUT routines for drawing basic wireframe objects. Also see Appendix D in the OpenGL Programming Guide. And for more specific information on each routine, see the man pages for glutSolidSphere, glutSolidCube, etc.

        void glutWireSphere(double radius, int slices, int stacks);
        void glutWireCube(double size);
        void glutWireTorus(double innerRadius, double outerRadius,
                             int sides, int rings);
        void glutWireCone(double radius, double height,
                             int slices, int stacks);
        void glutWireIcosahedron();
        void glutWireDodecahedron();
        void glutWireOctahedron());
        void glutWireTetrahedron();
        void glueWireTeapot();

David Eck