This is my fragment shader:
precision mediump float;
varying vec4 vColor;
void main(void) {
gl_FragColor = vColor;
}
This is my code that renders buffers associated with a circle (vertices and colors for each vertex):
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer);
gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, triangleVertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0);
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexColorBuffer);
gl.vertexAttribPointer(shaderProgram.vertexColorAttribute, triangleVertexColorBuffer.itemSize, gl.FLOAT, false, 0, 0);
setMatrixUniforms();
gl.drawArrays(gl.TRIANGLE_FAN, 0, triangleVertexPositionBuffer.numItems);
Is it possible to somehow render multiple instances of the circle, specifying the color each time? Is it bad practice to do so? Should I resort to making multiple circles, each with a pre-assigned color?