Assignment 1 Unsolved Questions - Computer Graphics | CMSC 427, Assignments of Computer Graphics

Material Type: Assignment; Class: Computer Graphics; Subject: Computer Science; University: University of Maryland; Term: Fall 2005;

Typology: Assignments

Pre 2010

Uploaded on 07/29/2009

koofers-user-mog
koofers-user-mog 🇺🇸

3

(1)

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Assignment 1
CMSC 427, Fall 2005
Due: 2:00pm Thursday, September 29, 2005
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
X11 Y11 X12 Y12
X21 Y21 X22 Y22
Xn1 Yn1 Xn2 Yn2
(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:
P3
# comments
Width Height
255
R1 G1 B1 R2 G2 B2 R3 G3 B3 … Rn Gn Bn
where, n = Width × Height
(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).

Partial preview of the text

Download Assignment 1 Unsolved Questions - Computer Graphics | CMSC 427 and more Assignments Computer Graphics in PDF only on Docsity!

Assignment 1

CMSC 427, Fall 2005

Due: 2:00pm Thursday, September 29, 2005

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

comments

Width Height 255 R 1 G 1 B 1 R 2 G 2 B 2 R 3 G 3 B 3 … Rn Gn Bn_

where, n = Width × Height

(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).