CS 420 Computer Graphics


Lab 9
Dr. Tong Yu, Fall 2007

Polygon Modeling

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

  • Make the directory ~your_login_name/cs420/mesh copy the files from /pool/u/class/cs420/polygon/mesh to it. Compile and execute mesh. You should see the tetrahedron displayed. Study the program mesh.cpp. The program reads data from a file with hardcoded filenmae "data.txt". Copy the data file "BARNMESH.TXT" to "data.txt" and execute mesh again. You are supposed to see a barn but the color used is for the tetrahedron and the display does not look pleasant. Try to modify the program so that it looks better. Also, the program displays all faces of the barn, which makes the view of barn not realistic. Now try to add the two statements glEnable( GL_CULL_FACE );
    glCullFace ( GL_BACK );
    in Mesh::drawMesh() to cull the back faces. Do you see a better barn?

  • Make the directory ~your_login_name/cs420/tween copy the files from /pool/u/class/cs420/polygon/tween to it. Compile and execute tween. ( Note that you need to put the canvas classes in the relative directory ../canvas to compile the tween program. If your canvas classes are not there, simply modify "Makefile" to point to the correct directory. ) Study tween.cpp. Modify it so that the morphing can go backward. Then make the increment step smaller and let the morphing go forward and backward for a number of times.

  • (EC 0.2 ) Write a program that morphs a "T" to an "I" in about 10 steps and back from "I" to "T".