LIGHTING Problem?!

Hello,

I am programming a board game -> Othello
and I have a problem with the light. After I move the frame the light is switching off, and only the tokens are visible with a 3d effect. The game board and the score board are not visible anymore.

Does anybody see my mistake?

void init(void)
{
GLfloat mat_specular[] = { -4.5, -9.0, -50.0, 1.0 };
GLfloat mat_shininess[] = { 50.0 };
GLfloat light_position0[] = { -4.5, -9.0, -16.0, 1.0 };
GLfloat light_position1[] = { -1.0, 1.0, 1.0, 1.0 };
GLfloat light_position2[] = { 0.0, 1.0, -1.0, 1.0 };
GLfloat light_position3[] = { 0.5, 0.5, -0.5, 0.5 };
GLfloat light_diffuse1[] = { 1.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse0[] = { 0.0, 1.0, 0.0, 1.0 };
GLfloat light_diffuse2[] = { 0.0, 0.0, 1.0, 1.0 };
GLfloat light_diffuse3[] = { 0.0, 0.0, 0.5, 0.5 };

glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);

glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);

glColorMaterial(GL_FRONT_AND_BACK, GL_EMISSION);
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);

glLightfv(GL_LIGHT0, GL_POSITION, light_position0);
glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 30);
glLightfv(GL_LIGHT2, GL_POSITION, light_position2);
glLightfv(GL_LIGHT2, GL_DIFFUSE, light_diffuse2);
glLightfv(GL_LIGHT1, GL_POSITION, light_position1);
glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse1);
glLightfv(GL_LIGHT3, GL_POSITION, light_position3);
glLightfv(GL_LIGHT3, GL_DIFFUSE, light_diffuse3);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHT2);
glEnable(GL_LIGHT3);
glEnable(GL_DEPTH_TEST);
glEnable (GL_COLOR_MATERIAL);
glEnable(GL_NORMALIZE);
}

Can you post your display function?

@McLeary, this was my mistake. I had to position the light in the display function. Now it works :slight_smile:

I still have one problem. The scoreboard which is hanging above the gameboard is dark. I tried already some different light positions, but nothing happened. It is still dark.

Does anybody have a handy hint? I don’t know what to do.