Lighting used to work, but now it doesn't

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);


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?

Ok. I figured it out, and I don’t think any of you guys would have guessed this one. It turns out that when my lights were loaded off the database, I treat them just like any other object. These objects have a matrix that defines their position. For some strange reason, my database didn’t have the fourth row in the matrix, so the positions were off in Timbuktu for one of the two light sources. If one light source is way off in left field, then for some strange reason, OpenGL just disregards lighting in general… Not good

I discovered that this particular light was way way off… something like 1.56e53 in all three, x y and z coordinates…