Jump to content
  • Advertisement
Sign in to follow this  
zhaoruijie

about the direction of a spot light

This topic is 3657 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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!