I am trying to assign unique id for each vertex being processed by the vertex shader in webgl1 as a color. Lets say I have 4 vertices and 6 indices representing the connectivity for two triangles that makes a quad. I want to assign unique color(from id) for each vertex in shader. Will the vertex shader be executed 6 times?,if so how can I assign unique id/color for 6 vertices. Actually I want to pick/select two different triangles based on color by reading the color from screen.All I have is a vertex and index buffer.
I have tried for non indexed geometries, Its working fine but dont know how to do it for index buffers since I dont know the internal working of shader.