PDA

View Full Version : different behavior during the resizing of window



Nonozor
02-10-2010, 03:59 PM
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!!!

Dark Photon
02-10-2010, 06:05 PM
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

Pziko
02-10-2010, 09:57 PM
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.