Hi
I have a dialog based MFC application written with C++. It can open windows with empty OpenGL context. Now I want to draw something in this context with another application. Therefore I save the ID of the opened window and give it to the second application. After clicking on “Refresh”-button in second application the OpenGL commandos draw a Rectangle on the whole window. It works under XP and Vista.
The problems comes with Vista after resizing the window. If I resize the window and click “Refresh” second time, the OpenGl context stays in the start size.
After clicking “Refresh first time”:
After resize+“refresh”
On clicking Refresh this code runs:
RECT rcCtl;
::GetClientRect((HWND)m_windowkeyattach, &rcCtl);
GetWindowDC();
int height=rcCtl.bottom, width=rcCtl.right;
glClear( GL_COLOR_BUFFER_BIT );
glLoadIdentity();
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glViewport( 0, 0, width,height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( -1,1, -1,1, -1, 1);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glBegin( GL_QUADS );
glColor3f(1.0, 0.0, 0.0);
glVertex3f(-1.0, -1.0, 0.0);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(-1.0, 1.0, 0.0);
glColor3f(0.0, 0.0, 1.0);
glVertex3f(1.0, 1.0, 0.0);
glColor3f(0.0, 0.0, 1.0);
glVertex3f(1.0, -1.0, 0.0);
glEnd();
SwapBuffers( hdc);
This “Feature” vanish if I turn PFD_DOUBLEBUFFER in pixel format off. But PFD_DOUBLEBUFFER is necessary for my application.
Knows somebody a solution for my problem? I use NVIDIA Quadro FX570 with newest driver and Vista 32Bit.
(sorry for my bad English)
BIGDen