In my program i load a DXF model, create a directional light and a camera, and move/rotate/translate/scale each of them.
My problem is that the objects are positioned well, but are lit as if they still were in the origin, and not relative to their real position.
This is the code of the rendeing part:
el=list;
while (el)
{
if (!el->specialFlag)
{
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnable(GL_NORMALIZE);
glLoadMatrixf(el->matrix);
glNormalPointer(GL_FLOAT,0,el->normalArray);
glVertexPointer(3,GL_FLOAT,0,el->vertArray);
glDrawArrays(el->type,0,(GLsizei)el->vertArrayCur/3);
}
el=el->next;
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glLoadIdentity();
el=list;
while (el)
{
if (el->specialFlag==POINTLIGHT)
{
for (i=0;i<4;i++)
lightPos[i]=el->lightPos[i];
multMatrVect(el->matrix,lightPos);
glLightfv(GL_LIGHT0,GL_POSITION,lightPos);
}
el=el->next;
}
(el->matrix holds the tranform matrix associated with that element;
el->specialFlag is 0 for objects, and !=0 for camera and light)




