## Interactive Computer Graphics - Assignment 2

### Drawing 2D Polygons with Color

Topics:

• Define polygon shapes

• Pass attribute data to vertex shader

• Pass color data to fragment shader

• Draw color-interpolated triangles.

Part 1:

Create the following picture:

Use the variables "vPosition" and "vColor" to pass the vertex and color information to the vertex shader.

The shapes should be drawn as GL_TRIANGLE{S,_FAN,_STRIP}s.

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 increment 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 as a function of angle to get the shading effect.
You should use a GL_TRIANGLE_FAN with the first vertex in the center of the circle.
You do not need to create the exact same interior shading pattern, but the shades along the circle's perimeter should be the same as in the example.

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. It's a good idea to base the square off of an angle, making the first point at pi/4, and then every pi/2 increment 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:

Write another program that creates another picture with at least 3 different objects using what you have learned!

You should not use the deprecated OpenGL functions in this or any other programming assignment.