s_fonden
04-18-2001, 05:02 AM
I seem to be having a problem getting my spotlights to be set up, I've been following the RedBook about dynamic lighting but I still am running into these problems.
Basically what I want to do is have spot lights follow each moving object (only 5 in all), positioned above the object's position and directed towards their position.
I update each light's position every time an object moves, and then render each object's light immediately before rendering each object. I am making sure the 'w' value of the position of the light is set 1.0 so it is specified as a "positional" light source, and I set the direction of the light through GL_SPOT_DIRECTION.
My result are spotlights that seem to originate from the center of my scene, all pointing to one corner of the scene, and never moving. They don't even appear to be positioned at the position of each object.
this is my rendering routine for each object:
glPushMatrix();
if(has_Light) light.render();
glTranslatef(oPosition[0], oPosition[1], oPosition[2]);
glRotatef(-oAngle[1], 0, 1, 0);
models.render();
glPopMatrix();
Any help? Thank you,
-steve
Basically what I want to do is have spot lights follow each moving object (only 5 in all), positioned above the object's position and directed towards their position.
I update each light's position every time an object moves, and then render each object's light immediately before rendering each object. I am making sure the 'w' value of the position of the light is set 1.0 so it is specified as a "positional" light source, and I set the direction of the light through GL_SPOT_DIRECTION.
My result are spotlights that seem to originate from the center of my scene, all pointing to one corner of the scene, and never moving. They don't even appear to be positioned at the position of each object.
this is my rendering routine for each object:
glPushMatrix();
if(has_Light) light.render();
glTranslatef(oPosition[0], oPosition[1], oPosition[2]);
glRotatef(-oAngle[1], 0, 1, 0);
models.render();
glPopMatrix();
Any help? Thank you,
-steve