How to get a flat, non-interpolated color when using vertex shaders.
- by Brett
Hi,
Is there a way to achieve this? If I draw lines like this
glShadeModel(GL_FLAT);
glBegin(GL_LINES);
glColor3f(1.0, 1.0, 0.0);
glVertex3fv(bottomLeft);
glVertex3fv(topRight);
glColor3f(1.0, 0.0, 0.0);
glVertex3fv(topRight);
glVertex3fv(topLeft);
.
.
(draw a square)
.
.
glEnd();
I get the desired result (a different colour for each edge) but I want to be able to calculate the fragment values in a shader. If I do the same after setting up my shader program I always get interpolated colors between vertices. Is there a way around this? (would be even better if I could get the same results using quads)
Thanks