1

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.

  • @NicolBolas Thanks. I finally understood the working of shaders. –  Jun 21 '19 at 14:18
  • If you're new to WebGL consider reading [these articles](https://webglfundamentals.org/webgl/lessons/webgl-how-it-works.html) – gman Jun 21 '19 at 17:05

0 Answers0