title: Quad texture stretching on OpenGL
body: <p>So when drawing a rectangle on OpenGL, if you give the corners of the rectangle texture coordinates of (0,0), (1,0), (1,1) and (0, 1), you'll get the standard rectangle.</p>
  
  <p>However, if you turn it into something that's not rectangular, you'll get a weird stretching effect. Just like the following:</p>
  
  <p><img src="https://i.stack.imgur.com/avuqc.png" alt="the weird stretching"></p>
  
  <p>I saw from <a href="http://www.xyzw.us/~cass/qcoord/" rel="nofollow noreferrer">this page</a> below that this can be fixed, but the solution given is only for trapezoidal values only. Also, I have to be doing this over many rectangles.</p>
  
  <p>And so, the questions is, what is the proper way, and most efficient way to get the right "4D" texture coordinates for drawing stretched quads?</p>