glClearColor+WM-SIZE+only part is cleared

Hi everyone,
I’m writing application (WinAPI+VS 2005).

I have created window and on WM_PAINT i’m clearing the buffer with a specified color. The problem is that when i changing the width of the window the new part that appears is not colorized.
Seems like OpenGL remembers the initial size of the window and repaints only it.

I’m creating the window with WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN|WS_CLIPSIBLINGS styles. Using default width and height. After creation i’m retreiving device context and set pixel format.
On WM_SIZE and WM_PAINT i do the following:

glViewport(view_port_x,view_port_y,view_port_width,view_port_height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,view_port_width,0,view_port_height);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_DEPTH_BUFFER_BIT);
glClearColor(1.0,0,0.f,1.0);
glClear(GL_COLOR_BUFFER_BIT);

view_port_width,view_port_height are window width and height. As far as i understand they do not have to affect the clorized area.
What i’m doing wrong?

Which OS, GPU, driver are you using?
What information do you get from GL? http://www.opengl.org/wiki/GlGetString

I’m using winXP SP3. glGetString(GL_VERSION) returns
“1.4.0 - Build 7.14.10.4885”. I’m using integrated video board:
Intel® 82945G Express Chipset Family.

Are you using the scissor box? If you are, disable scissoring with glDisable(GL_SCISSOR) before clearing the screen.

Yes. That was the issue. I was experimenting with the code and enabled it. Thanks a lot.

Don’t forget to re-enable scissoring afterwards.