Specifying the Vertices of our First Triangle (cont’d)

A more mathematical formulation

void main() {
    float vid = float(gl_VertexID);

    const float Pi = 3.14159265358979;
    const float DegreesToRadians = Pi / 180.0;

    float angle = vid * 120.0 /* Degrees */ * DegreesToRadians;

    vec2 v = vec2(cos(angle), sin(angle));

    gl_Position = vec4(v, 0.0, 1.0);
}