I want to emulate flat shading in a GLSL shader. Usually I would do that by passing the normal with a flat qualifier to prevent interpolation in the fragment shader.
However, flat is not available on GLSL 120.
How can I emulate it without duplicating the vertex data? (This is not premature optimization, rather post-mortem.)
You cannot exactly emulate
flatwithout direct hardware support (presumably as indicated by supporting GLSL 1.30+). Prior versions only offer all-or-nothing: either all attributes are interpolated or none are. That’s whatglShadeModeldoes.