Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I want to know the triangle ID of each rendered pixel is coming from. Is there a way to do this in OpenGL?
If you are using glsl version 410 or higher, you can use
to get a triangle id per pixel on fragment shader.
Hope this helps.
Required, but never shown