Advertisement

Changing Dimmer Light Position Using Keyboard

Started by May 17, 2000 03:27 PM
2 comments, last by zippo 24 years, 6 months ago
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
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
Check out my shadows page and send me some feedback
Advertisement
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
Glad to help!!


Check out my shadows page
and send me some feedback
Check out my shadows page and send me some feedback

This topic is closed to new replies.

Advertisement