title: OpenGl triangle interpolation issue
body: <p>I need to interpolate the red triangle on the left from white to black as depicted in the figure. I've extended it to a parallelogram to better understand the kind of interpolation that i'm trying to achieve.</p>
  
  <p><a href="https://i.stack.imgur.com/TLKql.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TLKql.png" alt="enter image description here"></a></p>
  
  <p>By assigning 1 to the white extremes of the triangle and zero to the bottom i'm not getting the expected results, I thought that this specific case wouldn't cause perspective coordinates issues due to the fact that triangle values are still mapped to a parallelogram and not a trapezoid, but I guess I was wrong.</p>
  
  <p>One solution would be as drawn in the right figure to find p1 by computing a vector intersection, compute the lenght of frag - p1 and compare it to length(v3 - v1) which would be too overkill for the fragment shader i'm using.</p>
  
  <p>Another also expensive solution would be to store the angle formed from the dots of the vertices vectors, and use a bit of trigonometry with p2 and frag to get a point in v1 - v3 to interpolate with the full segment, which is also crazy inefficient</p>
  
  <p>The end goal would be to draw a convex hull made of triangles from it's center to it's edges in a black to white fashion</p>
  
  <p>Edit: this question was marked as 'exact duplicate' of another one that as far as my understanding goes, has little to with what I asked. None of the provided responses helps my case and I'd like to at least know where exactly it could be defined as 'exact duplicate'</p>