reduce redundant webgl attribute data
<p>If I want to draw a red and blue square using triangles without multiple draw calls, as far as I'm aware that'd be 12 elements for the shape vertices (makes sense) but I'd also need to use 12 elements for only two colors because I need to define a color for each vertex which is exponentially redundant the more vertices I use for a shape.</p>

<p>Is there any way to, say, skip an attribute however many times such that these line up</p>

<pre><code>vertices = [0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1
            1, 1, 1, 2, 2, 1, 2, 1, 1, 2, 2, 2]
colors   = [1, 0, 0, 1,
            0, 0, 1, 1]
</code></pre>

<p>So the first color (the first vec4 in colors) applies to the first six points in vertices and the second color applies to the next six points.</p>

<p>Is this possible or do I have to redefine the same color for every vertex in a shape?</p>