## Interactive Computer Graphics: Assignment 1

Topics:

• call basic Callback functions like display function

• Display a window with given height width parameters

• Define polygons

• Fill polygons

• Set colors

• 2D viewing (viewport mapping)

• Displaying text

Part 1:

Create the following picture:

Use the glColor3f, glBegin(GL_POLYGON), and glVertex functions to create each of the shapes.

Use GLUT routines for the text.

The Circle: use the parametric equation of a circle to create multiple vertexes in a polygon. The parametric equations is:
y=sin( angle )
x=cos( angle )
You will need to step the angle between 0 and 2*pi to draw the circle. You can scale and move the circle by multiplying the coordinates and adding offsets to them. Vary the red color by the step of pi to get the shading effect.

The Ellipse: For the ellipse, use the same equation but scale the y down to 60% .

The Square: For the square, draw multiple squares on top of each other, varying the color from black to white. Its a good idea to base the square off of an angle, making the first point at pi/4, and then every pi/2 after that (this will help in the next assignment).

The Triangle: Its a good idea to use angle to draw the points here too.

The window should be 500x500 pixels.

Part 2:

Create another picture using what you have learned. Use points and lines, as well as polygons.

1. Basic display function: 2 points
2. 2D viewing : 2 points
3. Drawing polygons : 3 points
4. Setting colors : 2 point
5. Drawing text : 1 point

• Compilation Command

g++ -L/usr/X11R6/lib hw1.cpp -lglut -lGL -lGLU -o hw1

• Submission Guidelines:
1. Assignments must be submitted via WebCT.
2. README file: explain the features of your program, language and OS used, compiler used, commands needed to compile and link your program, name of file containing main(). Word documents will NOT be accepted.
3. All source code. Your code must compile and run on tux (Linux). MacOS X is a negotiable possibility. The TA will use one of these as the test platform.
4. You should be programming your assignments in C or C++.
5. Your program will be run by the TA. Please do NOT submit any image files, Visual C++ project files, or anything not requested in this section. Your program must run on tux without the installation of "special" libraries.
6. Makefile (optional but appreciated): have the default rule compile your program.
7. Points will be deducted if submission guidelines are not followed.