The order of adding lights and vertices to a scene
I've been reading the Redbook's chapter about lighting,
and although I have found some clues, I didn't manage
to get a definite answer to the following question:
at which stage are the lights calculated?
is it (1) during the call to glFinish(), after all lights
were specified and all vertices issued, or
(2) does it happen immediately, that whenever
new vertices are added, they get lit by the
lights that were already set up before that moment,
or (3) perchance it is implementation-specific?
Thanks in advance,
If lighting is enabled (glEnable(GL_LIGHTING)), then each vertex is assigned a colour based upon the vertex position and normal, the material, and the lights. The calculation is performed as each vertex is processed (i.e. glVertex() for immediate mode).
Originally Posted by panicz
Note that lighting state cannot be modified within a glBegin/glEnd pair, although material state can.