Docsity

Homework 1 Notes for Exam - Computer Graphics | CMSC 427, Assignments of Computer Graphics

Toggle sidebar
bg1
Assignment 1
CMSC 427, Fall 2001
Due: 11:00am Tuesday, September 25, 2001
This assignment involves using OpenGL programming API with the GLUT toolkit. The goal
is to implement a program that lets you look around in a 360-degree image panorama, re-orient a
gun turret, and move a plane icon in the sky.
You can find details about using OpenGL and GLUT on various platforms, links to download
OpenGL and GLUT on your PC or UNIX workstation, and Assignment 1 startup source code
at http://www.cs.umd.edu/class/fall2001/cmsc427/assg1/. Given the various
possible 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
final program works on machines in one of the following labs: Microsoft/WAM Lab (AVW 3452),
CSD Junkfood Lab (AVW 3457), or UMD WAM account. Before submitting your assignment you
should create a README file that gives details about which location your program works.
Copy files from www.cs.umd.edu/class/fall2001/cmsc427/assg1/code/. Com-
pile and run them after linking with OpenGL and GLUT. The sample program that we are giving
you does the following:
•It opens up a GLUT window of size 640 ×480.
•It displays a subset of the background image of a grass field.
•It displays a red line in the center of the window that corresponds to a gun barrel.
•It displays a plane on top of the background image in the top-right quadrant of the window.
(a) Make the plane move from left to right using the glutIdleFunc() function so that the
plane appears to be flying when no mouse or keyboard activity is happening in the window. When
the plane exits the right edge of the window make it appear from the left edge again. (5)
(b) Implement code that will allow you to control the direction of the gun barrel using the
mouse. When the left mouse button is pressed and the mouse is dragged to the right, the gun barrel
should turn to the right approximately proportional to the mouse movement. Similarly when the
mouse is dragged to the left, the gun barrel should move to the left. There are several ways of
implementing this. Just make sure that in your method the length of the gun barrel does not change
as it rotates. (7)
(c) In the GLUT window you are seeing a subset of a large image. In this part you should
implement the looking around feature in this environment. When the right mouse button is pressed
and dragged to the right, you should draw a subset of the background image that is to the right
of what was drawn in the current frame. Similarly dragging the mouse up, down, or right with
the right button pressed should draw appropriate subsets of the background image. Take care to
make sure that the left-right motion of the mouse results in a continuous movement in a 360-degree
fashion. The top-down movement should be constrained to be no more than what the image height
permits. (8)

Partial preview of the text

Download Homework 1 Notes for Exam - Computer Graphics | CMSC 427 and more Assignments Computer Graphics in PDF only on Docsity!

Assignment 1

CMSC 427, Fall 2001

Due: 11:00am Tuesday, September 25, 2001

This assignment involves using OpenGL programming API with the GLUT toolkit. The goal is to implement a program that lets you look around in a 360-degree image panorama, re-orient a gun turret, and move a plane icon in the sky. You can find details about using OpenGL and GLUT on various platforms, links to download OpenGL and GLUT on your PC or UNIX workstation, and Assignment 1 startup source code at http://www.cs.umd.edu/class/fall2001/cmsc427/assg1/. Given the various possible 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 final program works on machines in one of the following labs: Microsoft/WAM Lab (AVW 3452), CSD Junkfood Lab (AVW 3457), or UMD WAM account. Before submitting your assignment you should create a README file that gives details about which location your program works. Copy files from www.cs.umd.edu/class/fall2001/cmsc427/assg1/code/. Com- pile and run them after linking with OpenGL and GLUT. The sample program that we are giving you does the following:

  • It opens up a GLUT window of size 640 × 480.
  • It displays a subset of the background image of a grass field.
  • It displays a red line in the center of the window that corresponds to a gun barrel.
  • It displays a plane on top of the background image in the top-right quadrant of the window.

(a) Make the plane move from left to right using the glutIdleFunc() function so that the plane appears to be flying when no mouse or keyboard activity is happening in the window. When the plane exits the right edge of the window make it appear from the left edge again. (5)

(b) Implement code that will allow you to control the direction of the gun barrel using the mouse. When the left mouse button is pressed and the mouse is dragged to the right, the gun barrel should turn to the right approximately proportional to the mouse movement. Similarly when the mouse is dragged to the left, the gun barrel should move to the left. There are several ways of implementing this. Just make sure that in your method the length of the gun barrel does not change as it rotates. (7)

(c) In the GLUT window you are seeing a subset of a large image. In this part you should implement the looking around feature in this environment. When the right mouse button is pressed and dragged to the right, you should draw a subset of the background image that is to the right of what was drawn in the current frame. Similarly dragging the mouse up, down, or right with the right button pressed should draw appropriate subsets of the background image. Take care to make sure that the left-right motion of the mouse results in a continuous movement in a 360-degree fashion. The top-down movement should be constrained to be no more than what the image height permits. (8)