OpenGL stores light positions in eye space (what you call view space)
and that's where it does the calculations. However you can specify the
lights in any space you like. Lights get transformed through the
modelview matrix to position them in eye space so the space you compute
for lights depends on when you position them.
So, to specify lights in eye space (view space) you position them with
an identity matrix on the modelview stack. To position them in world
space you apply them after the viewing transformation has been applied
to the modelview stack. To position them relative to an object under
transformation (object space) you position the light after the object
model matrix has been multiplied with the view matrix on the modelview
Bottom line is that there's enough flexibility there for OpenGL to
accommodate how YOU want to specify light sources, so don't worry too
much about where you position them now, it's relatively straightforward
to switch this in OpenGL when you do the port.
> I have a 3D app I want to port to OpenGL. Currently, I do my own lighting,
> but I want to understand how/when OpenGL does its lighting calculations to
> make future ports easier. I currently light verts in "world" space. Not
> the most efficient, but easy to implement. So, my question is...
> Does OpenGL perform lighting in "model" space - i.e. prior to any
> transformations? If this is so, I have to take my world-space positions of
> lights and transform them back into "model" space - correct?!?
> Does OpenGL light verts in "view" space - i.e. after the modelview transform
> is applied. This would require either 1) positioning lights in model space
> (assuming OpenGL transforms them into view space) or 2) positioning lights
> in view space.
> Thanks in advance for any insight.
"Microsoft's system was like a forest that hadn't had a controlled
burn in decades, just waiting for one person with a match to turn
it into a disaster. Melissa was Microsoft's fault. They left their
system wide open to this sort of abuse, they knew it could happen
and did nothing." -- Bruce Perens
For advanced 3D graphics Performer + OpenGL based examples and tutors: