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?