Transforming normals

Not sure if this is the right place for this. It seemed about halfway between beginner and advanced to me.

I am running into a problem using OpenGL lights. I have a number of triangle lists being driven off of vertex arrays. One of the vertex arrays is a normal list. Each triangle list has a transformation matrix associated it which gets loaded with a glLoadMatrixd right before the list gets drawn with a glDrawElements.

Before the loop that draws the triangle stip, I setup the light (a single infinite distance light).

What is going wrong is that either the normals are not transforming, or the sun direction is transforming with the normals effectively cancelling it out, making the lighting look like it was simply painted on the object with a static lightmap.

Can someone give a clearer picture of what should be happening when. I checked the red book and it wasn’t as clear as I would have liked on the subkect/

Lights are transformed to eye space through the modelview.

You should not position the lights after the model matrix has been multiplied on the modelview unless the lights are positioned in the object space of that model matrix.

If the lights are in eye space position them when identity is on the modelview.

If the lights are in world space, position them after the viewing matrix transformation is on the modelview.

If the lights are in object space or have their own matrix position them after that matrix has been multiplied on the modelview.

Thanks. I got it sorted out.