normals and lighting problems

So I’m rendering an object using vertex arrays: position, normals, texcoords, ya know, the basics. I’m also rendering a light (and have used both directional and positional). The object renders fine.

So I move and rotate the object and render again (in the same frame), but it looks exactly the same, as if the light moved with it. If a light shines on the front of an object, and I rotate the object 180 degrees, the light should then shine on the back of it, right?

A possible cause could be that the normals don’t rotate… but wouldn’t this be bad behavior? My guess is I’m forgetting something simple. Any ideas?

-boog

Sounds like you are calling glLightfv with the position parameters after you’ve done the modelview transform for your object. You should do glLightfv immediately after your camera transform.

Here is some pseudocode for how to order your transforms with lighting and objects:

main loop
{

DoCameraTransform
Lights

for each object
{
PushMatrix
DoObjectTranform
DrawObject
PopMatrix
}

}

[This message has been edited by ioquan (edited 10-27-2003).]