different behavior during the resizing of window

Hello!

I made this code, just to test openGL:


glLightfv(GL_LIGHT0, GL_AMBIENT, red);
draw_object_A();
draw_object_B();
draw_object_C();
glLightfv(GL_LIGHT0, GL_AMBIENT, green);
draw_object_D();

All the objects (A, B, C, D) are green!!!
However, when I am resizing my window, A, B, C are red and D is green!

Somedy can tell me what is the standard behavior? (everything green or just D green)

Somebody has an idea of what is wrong when there isn’t the right behavior?

Thanks!!!

Hardly enough detail here, but I suspect a bit hint lies at looking at the code in your resize callback.

See this for ideas.

http://www.sjbaker.org/steve/omniv/opengl_lighting.html

Standard behaviour would be ABC red, D Green. I would guess your resize callback is actually correct (since your program works correctly after a resize), but your initialization code is wrong in some way. As a check try calling the resize code as a final call during initialization.