In the old OpenGL(glBegin, glEnd), when you draw a triangle strip, there was no way to set the color per-triangle. Only per-vertex. Is this the same with shaders? I would need to draw the heightmap from trianle strips but I need different colors for each triangle, …so the edges between them are visible. Thanks!
With old fixed-function OpenGL, you did have glShadeModel( GL_FLAT ), and there was a convention for which vertex’s color was used for the whole triangle.
What you’re talking about is termed flat shading, and AFAIK the capability for it it’s still there, but generalized for shaders. You can search for it in the latest OpenGL Spec:
In particular, see section “13.4 Flat Shading”. You can set which vertex in the primitive defines the color and other values for the whole primitive. In your GLSL shader, you mark the interpolator in your shader with the interpolation qualifier “flat” to signify that you don’t want it smoothly blended across the surface of the primitive, but left fixed. See the GLSL spec for details (in particular, Section 4.5 Interpolation Qualifiers):
Thanks! Works fine. Thats what I wanted!