stupid lights wont do wut i tell em!
supposedly, all i have to do, is change the position of the lights according to the camera. like if the light is supposed to be at 0,0,0 and the cam is at 0,2,0 then the light is at 0,-2,0.
but whenever i try this, it doesnt work, well, it kinda does.
I have display lists to display parts of the levels(2 rooms right now), and the light shows on each of them in the same corner, side, etc. plus, it does this other weird thing depending on which side im facing ... i can post scrn shots, if u need to see what im talking about. or code. which ever, just ask.
NARF - Pinky and the Brain
If your light is moving with your viewer it is because you have positioned your light before your viewing transformation.
* If you want you light positioned in local (eye) co-ordinates, position the light, then apply your transformations.
* If you want your light positioned in world co-ordinates, apply your transformations, then position your light.
* If you want you light positioned in local (eye) co-ordinates, position the light, then apply your transformations.
* If you want your light positioned in world co-ordinates, apply your transformations, then position your light.
I am positioning it after the viewing transformations, so maybe im positioning the lights wrong?? I''m using glLightfv(thisNumber, GL_POSITION, position); is there something else to move the light or update the position?
NARF - Pinky and the Brain
I can''t quite tell if you want your light to follow the cam or stay stationary in the world as the cam moves. The question is phrased a little strangely.
If you are positioning it after the viewing transformation it will remain stationary within the world - assuming the vector "position" isn''t changing. You might wanna check that you aren''t changing it...and be sure. Once I found that an out-of-range array (held just before the position vector in memory)was causing my light position vector to change! A right bugger to track down I can tell you!
If you are positioning it after the viewing transformation it will remain stationary within the world - assuming the vector "position" isn''t changing. You might wanna check that you aren''t changing it...and be sure. Once I found that an out-of-range array (held just before the position vector in memory)was causing my light position vector to change! A right bugger to track down I can tell you!
yes i want it to stay stationary in the world. I realized i had a logic error, fixed it, the problem is somewhat less noticable, but please check my work 
if the cam is at zval : -0.04
and the light is at zval : 0.00
then it should be transformed to zval : 0.04
right?
because it still doesnt work ...
[edited by - theprox on July 24, 2003 2:56:31 PM]

if the cam is at zval : -0.04
and the light is at zval : 0.00
then it should be transformed to zval : 0.04
right?
because it still doesnt work ...
[edited by - theprox on July 24, 2003 2:56:31 PM]
NARF - Pinky and the Brain
What order are you positioning your camera, light, and world in? Try an order like this:
PositionCamera(); // i.e. GluLookAt...
PositionLight(); // i.e. glLightfv(GL_LIGHT0, GL_POSITION,LightPosition)...
DrawWorld(); // position/rotate/draw all world polys
If it still doesn''t work, how about a code snippet?
PositionCamera(); // i.e. GluLookAt...
PositionLight(); // i.e. glLightfv(GL_LIGHT0, GL_POSITION,LightPosition)...
DrawWorld(); // position/rotate/draw all world polys
If it still doesn''t work, how about a code snippet?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement