
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; Class: Computer Graphics; Subject: Computer Science; University: University of Maryland; Term: Fall 2005;
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

This assignment involves familiarization with OpenGL, GLUT, and user interaction. The assignment web-page is at http://www.cs.umd.edu/class/fall2005/cmsc427/assg1/. Please refer to it for helpful links for OpenGL and GLUT, sample startup code, assignment images, submission instructions, and other clarifications. Given the various platforms and their configurations as well as our limited resources we would not be able to help you install OpenGL and GLUT on your personal systems. Please make sure that your program works on a university WAM/GLUE lab machine and create a README file that gives details about the platform on which your program works.
(a) Read in and display the CSIC floor plan as a set of lines from the file csic.lines in a GLUT window (5 points). The data file has the following format:
Number of lines X 11 Y 11 X 12 Y 12 X 21 Y 21 X 22 Y 22 … Xn1 Yn1 Xn2 Yn
(b) Read in and display the floor image from the file floor.ppm as a background to the lines drawn above (5 points). You can use calls such as glReadPixels( ) and glDrawPixels( ). The format of the ASCII PPM format file (for the purposes of this assignment) is as follows:
_P
Width Height 255 R 1 G 1 B 1 R 2 G 2 B 2 R 3 G 3 B 3 … Rn Gn Bn_
(c) Place the sprite (a small image) from the file spriteHappy.ppm inside a CSIC room drawn in (b). Move the sprite in left/right/up/down directions using the appropriate arrow keys (3 points). Implement simple collision detection of the sprite with the floor-plan lines so that it does not pass through walls (8 points). You may assume that the sprite is a square and the floor plan lines can only be vertical or horizontal.
(d) Change the sprite from spriteHappy.ppm to spriteCollision.ppm in the event of a collision and change it back to spriteHappy.ppm when it is moving without a collision (2 points). Use the glutIdleFunc( ) to continue moving the sprite in the same direction as the last arrow key pressed (2 points).