Lighting rotating with object? Eh?

Hi,

I’m writing a 3D Asteroids sort of game, and wouldn’t it be cool if my asteroid models were shaded? Unfortunately, whenever I try this, the lighting and shading for the object seems to rotate along with it(as if the lighting was some sort of texture). I’ve downloaded a tutorial from NeHe, and THAT program had the same problem. Can anyone give me a few pointers? Thanks.

                                  -Aramil

use glLightPos before you rotate the model.

I’m writing a 3D Asteroids sort of game, and wouldn’t it be cool if my asteroid models were shaded?
It most certainly would. And I love a good game of asteroids.

Perhaps your problem has to do with your light being in the wrong coordinate space? As I recal, OpenGL transforms the supplied light position with the current model-view matrix.

There’s a chapter on lighting in the on-line programming guide that describes this in good detail:
http://www.rush3d.com/reference/opengl-redbook-1.1/chapter06.html

Thanks a lot for the help, I appreciate it.

PS.(It’s working now, lol)