title: GLSL: How to access nearby vertex colors? (bilinear interpolation without uniforms)
body: <p>I'm trying to make bilinear color interpolation on a quad, i succeeded with the help of my previous question on here, but it has bad performance because its requires me to repeat glBegin() and glEnd() and 4 times glUniform() before glBegin().</p>
  
  <p>The question is: is it anyhow possible to apply bilinear color interpolation on a quad like this:</p>
  
  <pre><code>glBegin(GL_QUADS);
      glColor4f(...); glVertexAttrib2f(uv, 0, 0); glTexCoord2f(...); glVertex3f(...);
      glColor4f(...); glVertexAttrib2f(uv, 1, 0); glTexCoord2f(...); glVertex3f(...);
      glColor4f(...); glVertexAttrib2f(uv, 1, 1); glTexCoord2f(...); glVertex3f(...);
      glColor4f(...); glVertexAttrib2f(uv, 0, 1); glTexCoord2f(...); glVertex3f(...);
  ... // here can be any amount of quads without repeating glBegin()/glEnd()
  glEnd();
  </code></pre>
  
  <p>To do this, i think i should somehow access the nearby vertex colors, but how? Or is there any other solutions for this?</p>
  
  <p>I need this to work this way so i can easily switch between different interpolation shaders.</p>
  
  <p>Any other solution that works with one glBegin() command is good too, but sending all corner colors per vertex isnt acceptable, unless thats the only solution here?</p>
  
  <p><strong>Edit:</strong> The example code uses immediate mode for clarity only. Even with vertex arrays/buffers the problem would be the same: i would have to split the rendering calls into 4 vertices chunks, which causes the whole speed drop here!</p>