Triangle gradient with vertex array
I'm trying to make a triangle like the one in the right in the following picture:
The problem is that what I want to achieve is a gradient of color from vertexes 1 and 2 proyected from C.
As far as I know this is not possible since vertex C must have a color on it's own, which will also blend into 1 and 2's colors, like in the left triangle of the picture.
If I set C to a middle point color, this generates an undesired result, since the taller the triangle is made, the less noticiable are the other vertex's colors.
Line C1 should be black, and line C2 should be white.
Is there any way to achieve this in OpenGL?
You use a shader and texture coordinates, set the u coordinates to 0 at 1, 1 at 2, and 0.5 at C, then manually blend the 2 colours based on the value of u