Jump to content
  • Advertisement
Sign in to follow this  
zhaoruijie

about the direction of a spot light

This topic is 3750 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

I want to add a spot light into my scene. I set the position of the light as (x, y, z, 1.0), and the target of the light is (a, b, c). so I set the direction of the light like this(-(x-a), -(y-b), -(z-c)), I set the position and direction of the light after the gluLookAt function. and I have set the cutoff as reasonable value. but the result is the light path of the light is different frome the direction I set. How may it happen? how could I do? thanks very much!

Share this post


Link to post
Share on other sites
Advertisement
The light's position and direction are transformed by the current modelview matrix. Assuming you provided position and direction in world coords, try setting them before the gluLookAt() call.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!