CMSC 427 Fall 2004 Assignment: OpenGL, GLUT, and Interactive Perlin Noise, Assignments of Computer Graphics

An assignment for cmsc 427, fall 2004, which involves creating a glut application with opengl. Students are required to read and display background images, implement mouse-over functions, and create an interactive perlin noise function. The assignment also includes changing the number of octaves, zoom level, and color map of the displayed noise, as well as saving the image to a bmp file.

Typology: Assignments

Pre 2010

Uploaded on 07/30/2009

koofers-user-wcs-2
koofers-user-wcs-2 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Assignment 1
CMSC 427, Fall 2004
Due: 12:30pm Thursday, September 23, 2004
This assignment involves familiarization with OpenGL, GLUT, user interaction, and procedural
textures. The assignment web-page is at www.cs.umd.edu/class/fall2004/cmsc427/assg1/.
The skeletal program there has code to read and save BMP format image files.
(a) Read in and display the background image MenuBackground.bmp in a GLUT window
(3 points). We would like this to serve as the startup screen for a game that has three options
– new game, resume game, and exit. We have created six images to display these options.
The name of each image is of the form <option><selected or not><position of the lower left
corner of the image>. Thus, NewGameSelected387x638.bmp image is to be used
when the New Game option is highlighted and it has to be displayed with its lower left
corner at pixel x = 387 and y = 638 over the background image. Similarly,
ResumeGame346x559.bmp is to be displayed at location (346,559) to show the resume
game option in its un-highlighted form. Read and display each of the three default (un-
highlighted) option images at their correct positions (3 points = 1 point per option). Next,
implement a mouse-over function that changes the display of the option to its highlighted
form when the mouse moves over it (3 points = 1 point per highlighted option). Finally,
implement program exit when the user clicks on the exit option (1 point). (10 points)
(b) Implement an interactive version of the Perlin noise function. You can see Ken Perlin’s talk
at http://www.noisemachine.com/talk1/; for pseudo-code and more explanation check out
http://freespace.virgin.net/hugo.elias/models/m_perlin.htm. Start out by creating a 640 x 480
GLUT window to display the Perlin noise. We would like to be able to change the number of
octaves, the zoom level, and the color map of the displayed noise. The starting number of
octaves is 2. Set the initial zoom level so that there are about two periods of the displayed
octave contained within the window. The noise level should be scaled to the range [0, 255].
Display the resulting noise using grayscale (assign red, green, and blue colors to be the noise
level) (5 points). Pressing the lowercase <o> key should decrease the number of octaves by
1 and pressing the uppercase <O> key should increase the number of octaves by 1 (1 point).
Pressing the <+> key should increase the zoom by a factor of 2 and <-> key should zoom
out by a factor of 2 (1 point). Change the color of the Perlin noise function to switch
between grayscale (when key <1> is pressed), sky-like (when key <2> is pressed) (1 point)
and terrain-like (when key <3> is pressed) (1 point). We have implemented the sky-like
texture by clamping the color to blue (0, 0, 255) when the noise level < 64. When level
64,
the color is displayed as (level, level, 255). To get a terrain-like texture, we map the noise
level to (level, level, 255) when level < 64; to (64, level, 64) when 64 level < 192; and to
((level – 192)*191/63 + 64, level, (level – 192)*191/63 + 64)) when level 192. You can
play around and give us three similar options with one being grayscale, second being sky
with clouds, and the third being terrain. Also, feel free to implement the various parts (the
random number generator, for example) in a different way than described on the reference
web pages we have listed above. Finally, implement code to save the displayed image to a
BMP file when the user presses the <s> key (1 point). (10 points)

Partial preview of the text

Download CMSC 427 Fall 2004 Assignment: OpenGL, GLUT, and Interactive Perlin Noise and more Assignments Computer Graphics in PDF only on Docsity!

Assignment 1

CMSC 427, Fall 2004

Due: 12:30pm Thursday, September 23, 2004

This assignment involves familiarization with OpenGL, GLUT, user interaction, and procedural textures. The assignment web-page is at www.cs.umd.edu/class/fall2004/cmsc427/assg1/. The skeletal program there has code to read and save BMP format image files.

(a) Read in and display the background image MenuBackground.bmp in a GLUT window (3 points). We would like this to serve as the startup screen for a game that has three options

  • new game, resume game, and exit. We have created six images to display these options. The name of each image is of the form Thus, NewGameSelected387x638.bmp image is to be used when the New Game option is highlighted and it has to be displayed with its lower left corner at pixel x = 387 and y = 638 over the background image. Similarly, ResumeGame346x559.bmp is to be displayed at location (346,559) to show the resume game option in its un-highlighted form. Read and display each of the three default (un- highlighted) option images at their correct positions (3 points = 1 point per option). Next, implement a mouse-over function that changes the display of the option to its highlighted form when the mouse moves over it (3 points = 1 point per highlighted option). Finally, implement program exit when the user clicks on the exit option (1 point). (10 points)

(b) Implement an interactive version of the Perlin noise function. You can see Ken Perlin’s talk at http://www.noisemachine.com/talk1/; for pseudo-code and more explanation check out http://freespace.virgin.net/hugo.elias/models/m_perlin.htm. Start out by creating a 640 x 480 GLUT window to display the Perlin noise. We would like to be able to change the number of octaves, the zoom level, and the color map of the displayed noise. The starting number of octaves is 2. Set the initial zoom level so that there are about two periods of the displayed octave contained within the window. The noise level should be scaled to the range [0, 255]. Display the resulting noise using grayscale (assign red, green, and blue colors to be the noise level) (5 points). Pressing the lowercase key should decrease the number of octaves by 1 and pressing the uppercase key should increase the number of octaves by 1 (1 point). Pressing the <+> key should increase the zoom by a factor of 2 and <-> key should zoom out by a factor of 2 (1 point). Change the color of the Perlin noise function to switch between grayscale (when key <1> is pressed), sky-like (when key <2> is pressed) (1 point) and terrain-like (when key <3> is pressed) (1 point). We have implemented the sky-like

texture by clamping the color to blue (0, 0, 255) when the noise level < 64. When level ≥ 64 ,

the color is displayed as (level, level, 255). To get a terrain-like texture, we map the noise

level to (level, level, 255) when level < 64 ; to (64, level, 64) when 64 ≤ level < 192 ; and to

((level – 192)191/63 + 64, level, (level – 192)191/63 + 64)) when level ≥ 192. You can

play around and give us three similar options with one being grayscale, second being sky with clouds, and the third being terrain. Also, feel free to implement the various parts (the random number generator, for example) in a different way than described on the reference

web pages we have listed above. Finally, implement code to save the displayed image to a

BMP file when the user presses the key (1 point). (10 points)