NoelC
06-17-2010, 08:34 AM
I'm working on an app that renders OpenGL in a window. The dialog for the app, and the OpenGL-managed window within, is resizeable.
Upon window size change I am doing the classic commands listed in all the documentation for resetting the viewport size, and this works on most systems - but it simply isn't working on Windows XP 32 bit (SP3) with software OpenGL (1.1). Instead, the OpenGL viewport just remains at the size set when OpenGL was initialized, just after window creation.
// reset the viewport to the new dimensions
glViewport(0, 0, ProxyClientWidth, ProxyClientHeight);
// select the projection matrix and clear it out
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set up OpenGL for 2d rendering
gluOrtho2D(0, ProxyClientWidth, ProxyClientHeight, 0);
// Further drawing needs GL to be in model mode.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
Based on some experimentation, the problem seems to be tied to using the PFD_DOUBLEBUFFER flag in the pixel format descriptor used to SetPixelFormat(). If I remove PFD_DOUBLEBUFFER, the buffer size does change, but of course the display is noisy as it's being rendered on screen instead of behind the scenes.
Is this a known issue with older XP systems? Is there a workaround?
Thanks.
-Noel Carboni
Upon window size change I am doing the classic commands listed in all the documentation for resetting the viewport size, and this works on most systems - but it simply isn't working on Windows XP 32 bit (SP3) with software OpenGL (1.1). Instead, the OpenGL viewport just remains at the size set when OpenGL was initialized, just after window creation.
// reset the viewport to the new dimensions
glViewport(0, 0, ProxyClientWidth, ProxyClientHeight);
// select the projection matrix and clear it out
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set up OpenGL for 2d rendering
gluOrtho2D(0, ProxyClientWidth, ProxyClientHeight, 0);
// Further drawing needs GL to be in model mode.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
Based on some experimentation, the problem seems to be tied to using the PFD_DOUBLEBUFFER flag in the pixel format descriptor used to SetPixelFormat(). If I remove PFD_DOUBLEBUFFER, the buffer size does change, but of course the display is noisy as it's being rendered on screen instead of behind the scenes.
Is this a known issue with older XP systems? Is there a workaround?
Thanks.
-Noel Carboni