View Full Version : point light source rotations

10-16-2004, 09:40 PM
I have a cube with a spotlight attatched to the bottom of it. The spotlight shines on anything thats directly below it.

Problem is, this cube is mobile. When I translate or rotate the cube the light must stay with it. Now I know how to keep the light with the cube during a translation, but I'm not sure how to keep the light with the cube after a rotation (using glRotatef() )

Is there a way to get the cube coordinates after a glRotate() is performed on it?
Or better yet, is there a way to rotate a point light source using glRotate()?

10-18-2004, 09:50 AM
I believe if you place the light when you draw the cube, that would do it. I could be wrong. If so, I'm sure the red book has a section in the lighting chapter about having lights move with objects.