Processing math: 100%

CPSC362A
Video Game Development

Activity 2

Draw a Star

Create an OpenGL program that draws a five-pointed star.

Details

  1. Use a triangle fan where the fist point is the center of the star.

  2. The points of the star are on a circle. So the points can be computed using the equations:

    x=cos(θ)radius y=sin(θ)radius

    Where thea is the angle of rotation from the point (radius, 0) that the point is located.

  3. The inner points of the star are also on a circle. This circle’s radius is:

    inner_radius=outer_radiussin(18)/sin(136)

Example