Archived

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

Scraniel

Is it possible to create a moving light position and how please?

Recommended Posts

I''m wondering If I can have a light source rotate around an object so it shines light at different points on the object throughout its rotation? is it possible and will someone please tell me how to do it please? Thank you a lot. Scran

Share this post


Link to post
Share on other sites
I think you can use glLightfv along with the GL_POSITION tag, but I''m not posative. Good luck with it.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"

Share this post


Link to post
Share on other sites
Hey, I thought I''d bring this up now (even though it''s not part of this topic, sorry!):

How is it that people can just give people answers and give them the proper function to use? Is it out of memory? Do you look it up? It just sorta fascinates me...Sorry, I am a newbie!

Share this post


Link to post
Share on other sites
people get really confused with lighting, and with good reason.

When you call something like:

float fLightPos[4] = {1,0,0,1};
glLightfv(GL_LIGHT0, GL_POSITION,fLightPos);

the important thing is when you call it. Not what the value is.

its Becuase OpenGL will pass the array fLightPos through the modelview matrix, so if your matrix is setup for drawing an object way into the distance (gltranslare, rotate, etc), passing through fLightPos would then put the light right next to the object, where as calling it just after a loadIdentity would put the light right next to the view position.

So, to rotate the light (the quick and dirty way) pretend you are drawing a rotating object, using glRotatef and such, set the light to something like 0,0,10 and the light will then be rotating around your object 10 units above it.

Share this post


Link to post
Share on other sites