In second OpenGL window, everything is darker?

Hi all,
Under Windows 7, I’m drawing the same model in two different OpenGL windows. I’m setting up each window using the following code:

glutInitWindowSize (1000, 760); 
glutInitWindowPosition (10, 0);
window2 = glutCreateWindow ("title");
    glEnable (GL_DEPTH_TEST);
glEnable (GL_LIGHTING);
glEnable (GL_LIGHT0);
glEnable (GL_NORMALIZE);
    glClearColor (bg[0], bg[1], bg[2], 1.0f);
tmp[0] = tmp[1] = tmp[2] = amb;
tmp[3] = 1.f;
    glLightfv (which, GL_AMBIENT, tmp);
tmp[0] = tmp[1] = tmp[2] = spec;
tmp[3] = 1.f;
glLightfv (which, GL_SPECULAR, tmp);
tmp[0] = tmp[1] = tmp[2] = brt;
tmp[3] = 1.f;
glLightfv (which, GL_DIFFUSE, tmp);
glLightfv (which, GL_POSITION, pos);

Whereas the model is drawn using
the correct color (white) in the first window,
in the second window it is initially darker–
gray. Eventually it becomes partly white
and then fully white. My draw_scene function
uses the same global model color whether
drawing in the first or second window.

Does anybody have any idea what might cause this?

Anybody got any idea about this?

If you’re using the same context to draw in both windows, the intuitive first assumption is that the GL start you’re drawing the first window in is not the same as in the second window, OR the window properties are not identical (different bit depth, color type, etc.).

Yeah, it’s legacy, but might try a huge glPushAttrib( GL_ALL_ATTRIB_BITS ) / glPopAttrib around drawing for each window.

And are you using exactly the same code to create both windows?

Query the window properties of the windows and verify that they are the same. xwininfo in X will give you some of this.

Ah, I found the problem. It was a bug in my code. Thanks though.