|
|
|
Assignment 1: Simple Paint Program [50 points]
Due 9/11/2017
Purpose:
The purpose of this assignment is to become familiar with OpenGL and event-driven programming using GLUT.
Description:
Start with this basic opengl application. Once you have the program running, experiment with changing some of the values to get a feel for what the program does. Now we'll replace parts of the program to make a simple paint program.
- Make the window have a width to height ratio of 4:3 with the title "your name - Assignment 1"
- Remove the drawing code from the display function and make the program draw a rectangle from (-size, -size) to (size,size) centered at the current mouse position as the user drags the mouse (with a button clicked) across the screen. size is a variable that that user can increase by a factor of 2 by pressing '+' or decrease by a factor of 2 by pressing '-'. size should also be restricted to lie in the range [1,128].
- Allow the user to change the color of the polygon being drawn by pressing keys 1-7. The low order bit of the number should go in the red component, the middle bit in the green component and the high bit in the blue component. Therefore, 1=red, 2=green, 3=yellow, 4=blue, ..., 7=white.
- Allow the user to clear the screen to black by pressing 'c'. When your program first starts up, it does not matter what the screen contains since the user can clear it by pressing 'c'.
- Add multiple brushes that the user can cycle through by pressing 'b' repeatedly. You should start with the quad brush. The next brush should be a triangle with vertices (-size, -size), (size, -size), (0, size). The following brush will be a line brush with vertices (0,-size), (0,size). The final brush will be a circle brush with radius size.
- Since all of the brushes except the circle have an orientation, allow the user to change this orientation by pressing 'r' to rotate the brush about the center of the mouse by an additional 10 degrees. Hence, pressing 'r' once would create a rotation of 10 degrees for the quad, triangle and line brushes. Pressing 'r' again would create a rotation of 20 degrees and so forth.
- EXTRA CREDIT: Allow the user to press 'a' to toggle the circle brush between the solid circle and the spray paint brush demonstrated in class that blends with the drawing on the screen.
Grading:
[5] Window correct size and title
[5] Changing brush size
[5] Changing color of brush
[5] Clearing screen to black when user presses 'c'
[5] Mouse input and correct placement of brush at mouse position
[20] Correct implementation of quad, triangle, line and circle brushes
[5] Rotation of brushes when user presses 'r'
[10] Extra credit: spray paint brush
|