Thank you for your response
I tried your suggestion that applying
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
I notice that the SPECULAR and DIFFUSE light doesn’t apply to back face.
Only AMBIENT does.
For example, I tried this for another source code.
I set the same material properties to FRONT_AND_BACK face.
I expected that the both faces turns white.
As expected, the front face turns white.
However the back face turns pure red. ???
Why the back face uses the AMBIENT property only?
gl.glLightModeli(GL2.GL_LIGHT_MODEL_TWO_SIDE,GL2.GL_TRUE);
gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL2.GL_TRUE);
gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, new float[] {0,0,0,0}, 0);
gl.glLightModeli(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SEPARATE_SPECULAR_COLOR);
gl.glEnable(GL2.GL_LIGHT1);
gl.glLightfv(GL2.GL_LIGHT1, GL2.GL_POSITION, new float[] {0,0,1,0}, 0);
gl.glLightfv(GL2.GL_LIGHT1, GL2.GL_AMBIENT, new float[] {1.0f,1.0f,1.0f,1.0f}, 0);
gl.glLightfv(GL2.GL_LIGHT1, GL2.GL_DIFFUSE, new float[] {1.0f,1.0f,1.0f,1}, 0);
gl.glLightfv(GL2.GL_LIGHT1, GL2.GL_SPECULAR, new float[] {1,1,1,1}, 0);
gl.glMaterialfv(GL2.GL_FRONT_AND_BACK, GL2.GL_EMISSION, new float[] {0,0,0,0}, 0);
gl.glMaterialfv(GL2.GL_FRONT_AND_BACK, GL2.GL_AMBIENT,
new float[] {1,0,0,0},
0);
gl.glMaterialfv(GL2.GL_FRONT_AND_BACK, GL2.GL_DIFFUSE, new float[] {1,1,1,1}, 0);
gl.glMaterialfv(GL2.GL_FRONT_AND_BACK, GL2.GL_SPECULAR, new float[] {1,1,1,1}, 0);
gl.glMaterialf(GL2.GL_FRONT_AND_BACK, GL2.GL_SHININESS, 25.0f);