

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Varshney; Class: ADV COMP GRAPHICS; Subject: Computer Science; University: University of Maryland; Term: Spring 2002;
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Due: 12:30pm Thursday, April 18, 2002
This assignment involves extending your code for Assignment 2 to deal with a virtual walk- through of the AV Williams building.
(a) Read the geometry and image data files. The geometry description of the fourth floor of AV Williams bldg is in the data file avw.dat. The data is in the following ASCII format:
x 1 y 1 z 1 x 2 y 2 z 2 x 3 y 3 z 3 x 4 y 4 z 4 r g b
Note that there is a color for each quad. Also note that there is a layer named ARTEXT that contains extrusions of the appropriate room numbers. You are not required to draw it, but you might anyway to help you find your way during the walkthrough. We are providing four texture map files for elevators, ceiling, door, and floor named elv.jpg, ceiling.jpg, door.jpg, and ground.jpg. The assignment web-page also has the PPM versions of these files. If you need any other kind of format, please contact the TA. Alternatively, if you convert them to some other format, make sure that you submit your project with the appropriate format image files. Write the code to read these texture image files. (3 + 2)
(b) Use your Assignment 2 code to display the data you have read in part (a). Write code to implement texture mapping for the doors, the ceiling, the floor, and the elevator. For ceiling and ground you should tile the texture and for the doors you should stretch the texture to cover the entire door. For now, you can map the door texture to the windows. There is no texture for the walls. (5).
(c) Implement walking around by mouse movements. Start with user at (54600, 22000 , 200) and looking along the direction (0, 1 , 0). This is close to the fourth floor elevators. Implement walking and looking around as follows:
(5) (d) Assume that your implementation of OpenGL only allows 8 lights. The data file has 199 lights. They are given as quads under the layer LAMPS. Use the nearest visible 8 lamps as OpenGL light sources and display the rest as appropriately colored rectangles. Obviously the selection of the nearest 8 lamps will change dynamically as the user moves about. To find out the 8 nearest visible lights, render the lights in unique colors in the back-buffer, read back the back-buffer, scan it to determine which lights are visible and their depths. This will tell you which lights deserve to be lighted. Now clear the back-buffer and re-render the entire scene (again in the back-buffer) with these 8 lights turned on and then swap the front and back buffers. Use the glTexEnv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param) command to allow textured polygons to be lighted. (5)