Trying to light my scene with no joy

Hello guys i have been reading on this forum for ages now but i would like to ask my first question.

I have a 3d scene which i am trying to light up. I have set up my positional light but the problem is when i enable lighting the scene goes extremely dark. You can only just make out that areas are lit. What i want is a scene that when lit most places look like they would with no lighting. I hope this makes sense. I have included a part of my code that deals with the lighting. I hope you guys can help.

I have set normals for the flat ground to be (0,1,0) and for a simple cuboid with the correct normals.

Tom

// variables
float LightAmbient[]= {1, 1, 1, 1};
float LightDiffuse[]= {1, 1, 1, 1};
float LightPosition[]= {100,100,100,1};

// called in my init function
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
glLightfv(GL_LIGHT0,GL_AMBIENT,LightAmbient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION,0.1);
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);

// In the callback function as eventually i would like the light to move
glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);

Just in case you are terribly unlucky and your
polygons are oriented in just the wrong way, try:

glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);

This might not even help, for you said you do see
stuff on your screen, but it just looks dark…

just tried it m8 but with no difference what so ever. :frowning:

Depending on what you are trying to accomplish, I believe you have to set up materials for your objects for lighting to work correctly. Normals will also have to be calculated for each object. Check out chpt 5 in the redbook for basic lighting examples.

your light is not so close, and depending on your object size it’s even quite far.
comment the 2 lines
//glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION,0.1);
//glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05);
and try again.

also check that your camera looks is the right direction :wink:

Thanx guys i went into uni earlier this week and spoke to a couple of PHD guys and they said exactly what G_gl said and it seems to work fine now.

As for the shadow on the objects being wrong the problem was that i was rotating and translating after the eye was positioned. Fixed that one as well.

Thanx for all the help guys