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

Started by
5 comments, last by Scraniel 22 years, 9 months ago
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
Advertisement
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!"
Alex BroadwinA-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!"
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!
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.
The Red book and chapter06, you lazy duck.
yes, you should read the red book, the lighting chapter (6 probably). there was something about moving lights in there.

---

cone3d

http://cone3d.gz.ee
-> soon http://cone3d.gamedev.net
---cone3dhttp://cone3d.gamedev.netMy software never has any bugs - it just generates random features
take a look at http://nate.scuzzy.net/programming/ and search for the fake dynamic lights tutorial, source code included !

glHorizon_Project



www.web-discovery.net


This topic is closed to new replies.

Advertisement