Docsity

Homework 2: 2D Interactive Graphics | CS 470, Assignments of Computer Graphics

Toggle sidebar
bg1
Homework 2 : Due Sept. 6, 2006
CS 470
August 28, 2006
1 2D Interactive Graphics
The goal of this homework is to learn to write GLUT callback functions for rendering and user input,
and to become familiar with OpenGL through basic 2D rendering. You may use the file gltest.cc
from homework 1 as a starting point.
1.1 Specification
Your will create an interactive 2D application with the following features:
•10% - Open a 480 ×480 window. The text in the titlebar should read ’Homework 1’.
•10% - The background color should be white with gray horizontal and vertical grid lines every
0.1 units. The grid lines through the origin should be 2 pixels wide, all others should be 1
pixel wide. This grid background should appear behind all other graphics.
•20% - Using the glut bitmap text routines, write a set of state-based string drawing functions.
Draw your name in the lower left-hand corner of the screen. The text in this assignment should
appear on top of all other graphics.
•10% - Render an unfilled polygon of 12 vertices using points and lines. Render the vertex
points in red, four pixels wide. Render the edges of the polygon in blue, with 2 pixel wide
lines. The initial polygon should approximate a circle of radius 0.75 units with evenly spaced
vertices.
•20% - The user should be able to select and move vertices of the polygon using the mouse.
When the user clicks the left mouse button over one of the vertices, that vertex will be dragged
to the current mouse location until the button is released.
•10% - While a vertex is selected, text in the lower right-hand corner should report the current
x,y coordinates of that vertex. If no vertex is selected, nothing should be displayed.
•10% - Pressing ’R’ or ’r’ key should reinitialize the polygon to its original shape. Pressing the
ESC key should cause the program to exit.
•10% - Documentation.
Either full or zero credit will be given for each of these specifications.
2 What to turn in
Submit all source code, a README file, and a working project file or Makefile which builds an
executable named ’hw2’ or ’hw2.exe’. Turn in a single tarred and gzipped, or zipped file by the start
of class on the due date.
1

Partial preview of the text

Download Homework 2: 2D Interactive Graphics | CS 470 and more Assignments Computer Graphics in PDF only on Docsity!

Homework 2 : Due Sept. 6, 2006

CS 470

August 28, 2006

1 2D Interactive Graphics

The goal of this homework is to learn to write GLUT callback functions for rendering and user input, and to become familiar with OpenGL through basic 2D rendering. You may use the file gltest.cc from homework 1 as a starting point.

1.1 Specification

Your will create an interactive 2D application with the following features:

  • 10% - Open a 480 × 480 window. The text in the titlebar should read ’Homework 1’.
  • 10% - The background color should be white with gray horizontal and vertical grid lines every 0.1 units. The grid lines through the origin should be 2 pixels wide, all others should be 1 pixel wide. This grid background should appear behind all other graphics.
  • 20% - Using the glut bitmap text routines, write a set of state-based string drawing functions. Draw your name in the lower left-hand corner of the screen. The text in this assignment should appear on top of all other graphics.
  • 10% - Render an unfilled polygon of 12 vertices using points and lines. Render the vertex points in red, four pixels wide. Render the edges of the polygon in blue, with 2 pixel wide lines. The initial polygon should approximate a circle of radius 0.75 units with evenly spaced vertices.
  • 20% - The user should be able to select and move vertices of the polygon using the mouse. When the user clicks the left mouse button over one of the vertices, that vertex will be dragged to the current mouse location until the button is released.
  • 10% - While a vertex is selected, text in the lower right-hand corner should report the current x,y coordinates of that vertex. If no vertex is selected, nothing should be displayed.
  • 10% - Pressing ’R’ or ’r’ key should reinitialize the polygon to its original shape. Pressing the ESC key should cause the program to exit.
  • 10% - Documentation.

Either full or zero credit will be given for each of these specifications.

2 What to turn in

Submit all source code, a README file, and a working project file or Makefile which builds an executable named ’hw2’ or ’hw2.exe’. Turn in a single tarred and gzipped, or zipped file by the start of class on the due date.