these are my settings for diffuse,ambient and specualar and the position of my light. My scene looks extremly lit with specualar light. I have tried adjusting the position of the light but that doesn't to anything. GLfloat greenDiffuseMaterial[] = {0.0, 1.0, 0.0,1.0}; GLfloat whiteSpecularMaterial[] = {1.0, 1.0, 1.0,1.0}; GLfloat greenAmbientMaterial[] = {0.0, 1.0, 0.2,1.0};
GLfloat greenEmissiveMaterial[] = {0.0, 1.0, 0.5,1.0};
GLfloat lightPosition[] = { 0.0,1.0,0.0, 0.0};
GLfloat ambientLight[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat diffuseLight[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat specularLight[] = { 1.0, 1.0, 1.0, 1.0 };
EDIT 1
for (int g =0;g<6400;g++){
glBegin(GL_QUADS);
if(mountText %2 ==0){glTexCoord2f(islandVert[g][0] /xscale,islandVert[g][2] / zscale);}
else{
glEnable(GL_NORMALIZE);
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_DEPTH_TEST);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, greenAmbientMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, greenDiffuseMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, whiteSpecularMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mShininess);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);}
glNormal3f(vertNorm[g][0],vertNorm[g][1],vertNorm[g][2]);
glVertex3f(islandVert[g][0],islandVert[g][1],islandVert[g][2]);
g++;
if(mountText %2 ==0){glTexCoord2f(islandVert[g][0] / xscale, islandVert[g][2] / zscale);}
else{
glEnable(GL_NORMALIZE);
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_DEPTH_TEST);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, whiteSpecularMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, greenAmbientMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, greenDiffuseMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mShininess);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);}
glNormal3f(vertNorm[g][0],vertNorm[g][1],vertNorm[g][2]);
glVertex3f(islandVert[g][0],islandVert[g][1],islandVert[g][2]);
g++;
if(mountText %2 ==0){glTexCoord2f(islandVert[g][0] / xscale, islandVert[g][2] / zscale);}
else{
glEnable(GL_NORMALIZE);
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_DEPTH_TEST);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, greenAmbientMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, greenDiffuseMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, whiteSpecularMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mShininess);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);}
glNormal3f(vertNorm[g][0],vertNorm[g][1],vertNorm[g][2]);
glVertex3f(islandVert[g][0],islandVert[g][1],islandVert[g][2]);
g++;
if(mountText %2 ==0){glTexCoord2f(islandVert[g][0] / xscale, islandVert[g][2] / zscale);}
else{
glEnable(GL_NORMALIZE);
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_DEPTH_TEST);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, greenAmbientMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, greenDiffuseMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, whiteSpecularMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mShininess);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);}
glNormal3f(vertNorm[g][0],vertNorm[g][1],vertNorm[g][2]);
glVertex3f(islandVert[g][0],islandVert[g][1],islandVert[g][2]);
glEnd();
}
Basiclly at each cordinate I check if the texture is on or not and if it's not I want to set it to the original green material. The result I'm getting is that one side of my object is extremly lit up and the other side is ambient. The vertex normals work because there is smooth shading but I think it might have something to do with the position of my light. When I try to change it the scene remains the same.