I have this OpenGL initialization code:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_POINT_SMOOTH);
glEnable (GL_DEPTH_TEST);
glEnable (GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_NORMALIZE);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,0);
glEnable (GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT,GL_DIFFUSE);
GLfloat mat_ambient[] = { 0.0, 0.0, 0.0, 0.0 };
GLfloat mat_specular[] = { 0.0, 0.0, 0.0, 0.0 };
GLfloat mat_diffuse[] = { 0.0, 0.0, 1.0, 1.0 };
glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient);
glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse);
light_t light={
{2.0,-1.0,-2.0, 0.0},
{1.0,1.0,1,1.0},
{0,0,0,0},
{1.0,1.0,1.0,0.2}
};
glLightfv(GL_LIGHT0,GL_POSITION,light.pos);
glLightfv(GL_LIGHT0,GL_DIFFUSE,light.diffuse);
glLightfv(GL_LIGHT0,GL_SPECULAR,light.specular);
glLightfv(GL_LIGHT0,GL_AMBIENT,light.ambient);
glShadeModel (GL_SMOOTH);
The lighting works well except that it is difficult to differentiate between polygons that are in the light (not in edges, where there is shadow). For example if there is a bit sticking out of the model, it can hardly be seen when it is facing towards the “camera”. I have tried different values for the material and light properties, but the problem persisted. How to solve this?