Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

zippo

Changing Dimmer Light Position Using Keyboard

This topic is 6915 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 was wondering if there''s a way to change the position of a dimmer light using the keyboard (for example, one "press" of the 6 on the numpad would move it a coordinate to the right). From what I''ve seen in the tutorials (particularly the one on lighting), the lighting''s position is set only once during the window''s initialization. Can it be changed in the DrawGLScene function, or is there another way around this? All replies are welcome. zippo

Share this post


Link to post
Share on other sites
Advertisement
yes you just have to call the method to set the lighting again with the new light position
i.e.
lightpos={x,y,z,1.0f};
glLightfv(GL_LIGHT1, GL_POSITION,lightPos);

assuming you are changeing Light1 in the scene

Check out my shadows page
and send me some feedback

Share this post


Link to post
Share on other sites
Thanks for the info! I wasn''t sure if I could just call it again like that. Good to know. I figured I could, but was at the office at the time, so couldn''t really try it out. I figured since I''m here, I might as well ask real quick. I tried it out and it works like a gem. I took a quick glance at your shadows reference/tutorial/program and found it to be very enlightening. I''m sure I''ll be going back to it for closer examination. Thanks again!

zippo

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!