title: Applying color to single vertices in a quad in opengl
body: <p>I'm trying to color single vertices of quads that are drawn through <code>glDrawElements</code>, I'm working with <strong>cocos2d</strong> libray, so I've been able to scavenge the source code to understand exactly what is happening, code is the following:</p>
  
  <pre><code>glBindVertexArray( VAOname_ );
  glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (start*6*sizeof(indices_[0])) );
  glBindVertexArray(0);
  </code></pre>
  
  <p>So vertex array objects are used. I'm trying to modify single vertices color of the objects that are passed and it seems to work but with a glitch which is described by the following image:</p>
  
  <p><img src="https://i.stack.imgur.com/25DUo.png" alt="enter image description here"></p>
  
  <p>Here I tried to change the color of the lower left and right vertex. The result is different, I guess this is because the quad is rendered as a couple of triangles with shared hypotenuse which resides on the diagonal which goes from lower left vertex to higher right vertex. So this could cause the different result.</p>
  
  <p>Now I would like to have the second result also for the first case. Is there a way to obtain it?</p>