PDA

View Full Version : Ambient light to bright



_misq
06-02-2011, 06:40 PM
Hi! I have disabled all my light sources, but the objects that I render don't become completely black. First when I have one light source enabled, and set the ambient light to be negative (-0.2 in the r, g and b components) I get a completely black scene. What is that light that won't disappear, even when I have no light sources at all, and how can I get rid of it?

AmzBee
06-02-2011, 07:00 PM
Daft question, but are you clearing the screen with a colour that is not black?

ZbuffeR
06-03-2011, 12:10 AM
Probably you did not set the global ambient light to 0 (default is 0.2) :
http://www.opengl.org/sdk/docs/man/xhtml/glLightModel.xml

_misq
06-03-2011, 09:23 AM
Probably you did not set the global ambient light to 0 (default is 0.2) :
http://www.opengl.org/sdk/docs/man/xhtml/glLightModel.xml

Thanks, the following code solved it


//Elimitate global ambient light
GLfloat black[] = {0, 0, 0, 1};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, black);