Problem in lightening

I have my own model ( with its own model matrices…)Now the problem is …

I am using the function…

ApplyLightPosition(float *pArrPos)
{

DumpArrayLogf("ApplyLightPosition
", pArrPos ,4); // My own debug function
// position being set separately
glLightfv(glLightId , GL_POSITION, pArrPos);

}

I am using directional light , so pArrPos[3] = 0;

My test cases / approaches are as follow…

  1. My display on some machines is flattened… If I change the pArrPos[3] = 1. I can see a lightened display , But I want to keep directional lightening.

  2. Then I tried offscreen rendering , the display is flattened consistently… I checked my matrices, they are correct…

  3. I tried some experimenting like making some change in pArrPos[0]( like I subtracted some random value from it , like 10 ). I could see the model rendered.

I imagine a situation such taht the light is being moved away to infinity by OpenGl…This may be wrong…

I am still a begineer at OpenGl… need help … thanks in advance…

Hi,

Two cases where this could happen (and I’m not even sure about them) are:

  1. Your light position is (0, 0, 0), making that directional doesn’t make a sense.

  2. Your light has some attenuation, which makes the light contribution always zero, when the light is at infinity.

If it’s neither, I’m afraid I can’t help you.

-Ilkka