Sign in to follow this  

world and camera space

This topic is 4715 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I have a simple app with a model at 0,0,0 and a spot light at 6,0,0 pointing -1,0,0. The problem is that when I move the camera, the light moves with it. How do I keep the light where it is? The effect I am getting is a torch in front of me. I do this (psudo):- Start the scene Update mouse and keyboard Set the camera Set the translation matrix to 0,0,0 Push Matrix Render Model Pop Matrix End Scene Thanks

Share this post


Link to post
Share on other sites
I'm not sure where you have your lighting code now, but it is most likely in your render function. Basically you want to set up your light in some init() function where it is only set up ONCE. (Make sure the glLoadIdentity() is called before it).

Share this post


Link to post
Share on other sites
I setup the light in the init method. It's weird, when using a directional light and a rotating model, the light seems to move along a different path to the model. So when the model gets to a certian rotataion, it gets lite in a ceritan way as thgough the light is moving....

Share this post


Link to post
Share on other sites
If you're using OpenGL lighting, it's enough to just update light position and spot direction after you've positioned your camera (or anything that alters modelview matrix).

If you're using shaders, take a look at this (last few posts).

Share this post


Link to post
Share on other sites

This topic is 4715 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this