I have been working with OpenGL for quite some time, and have never had this kind of problem. I had lighting working just fine, and then I put in a little bit of code to make lens flares… And then everything went full bright. I “do” the flares just before enabling lighting, so there isn’t a disparity between enables and disables. I have gone through my code with a fine tooth comb.
Here is the code I use to enable lights on the per-light basis…
void Star::SetupDraw(C3DObject *pCamera)
{
DVector v = GetPosition() - pCamera->GetPosition();
float lPosition[4] = {0.0f, 0.0f, 0.0f, 1.0f};
float fDiffuse[4] = {red, green, blue, 1.0};
float fAmbient2[4] = {0.0f, 0.0f, 0.0f, 0.0f};
lPosition[0] = v.x;
lPosition[1] = v.y;
lPosition[2] = v.z;
glLightfv(GL_LIGHT0+num, GL_POSITION, lPosition);
glLightfv(GL_LIGHT0+num, GL_DIFFUSE, fDiffuse);
glLightfv(GL_LIGHT0+num, GL_AMBIENT, fAmbient2);
glEnable(GL_LIGHT0+num);
}
I do not suspect this code at all… I just add it here in case there may be something wrong now. I have “reshuffled” it just to see if I could get lighting working again, so I may have made it wrong. GL_LIGHTING is enabled before that code is run.
What exactly could cause lighting to “switch off” aside from the lack of normals or disabling lighting?