Original Post
I've got some problems with my lighting, which I have only just started to learn. I have defined my normals correctly I think, and I have a red, diffuse light coming from distance to light my scene. However, some faces are not being lit, including the ground, which is confusing me. Also, the amount of light coming off faces is changing when I move around the scene. I want my light source to be stationary. I've looked this up and can't get my head around it. Here is a pic
I have the following code inside my display function. I can provide full code if anyone thinks they can help. float ambientLight[]={0.0,0.0,0.0,1.0}; // set ambient light parameters glLightfv(GL_LIGHT0,GL_AMBIENT,ambientLight); float diffuseLight[]={1.0,0.0,0.0,1.0}; // set diffuse light parameters glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuseLight); float specularLight[]={0.5,0.5,0.5,1.0}; // set specular light parameters glLightfv(GL_LIGHT0,GL_SPECULAR,specularLight); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientLight); // set light model glEnable(GL_COLOR_MATERIAL); // activate material glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE);
I have the following code inside my display function. I can provide full code if anyone thinks they can help. float ambientLight[]={0.0,0.0,0.0,1.0}; // set ambient light parameters glLightfv(GL_LIGHT0,GL_AMBIENT,ambientLight); float diffuseLight[]={1.0,0.0,0.0,1.0}; // set diffuse light parameters glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuseLight); float specularLight[]={0.5,0.5,0.5,1.0}; // set specular light parameters glLightfv(GL_LIGHT0,GL_SPECULAR,specularLight); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientLight); // set light model glEnable(GL_COLOR_MATERIAL); // activate material glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE);