roguespear
10-24-2004, 05:06 AM
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);
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);