Drawing MFC objects with OpenGL with Win7 Aero

Hello programmers,

I solve a strange behavior of MFC graphic objects together with OpenGL objects when Windows 7 Aero is enabled on my desktop. I describe that matter more detail now, I have created MDI application by MFC framework in VC++ where I have implemented OpenGL functions to draw 3D objects. In some child windows, there is a need to draw any 2D graphic objects provided by MFC (e.g. ellipse) realized by CDC to that window where has been drawn OpenGL 3D object. When Aero is disabled, it works excellently but if it’s enabled, then e.g. ellipse is drawn into a rectangle area that has a background including rubbish of some graphical buffer (probably second buffer of the double buffer drawing). I know, the Aero is a new technology implemented there that uses double buffer mechanism. I’m also able to disable Aero motive from my application, but it has a global influence to all running applications because their appearence is change to the basic motive. I don’t want to solve this problem by disabling the Aero, it’s not professional. I would like to solve the objects drawing where I mix OpenGL rendering context together with MFC device context in one child window.

When I specify the PIXELFORMATDESCRIPTOR structure for the SetPixelFormat function with PFD_DOUBLEBUFFER flag, then I have the mentioned problem. When I change the flag to PFD_SUPPORT_GDI, then it works properly but the 3D objects drawing is too slow, it’s really unusable.

Does anybody know how to solve this unpleasant problem with mentioned graphical constellation?

Is there any mechanism to block the double buffers drawing?

Thanks for answers.


Have a read of this: http://www.opengl.org/pipeline/article/vol003_7/

GDI usage over 3D accelerated regions is incompatible with Windows Aero, so developers have two options:

Disable Windows Aero
Do not use GDI on top of OpenGL rendering.


thanks for reply.


it’s the same with vista
I think you can overlay GDI with opengl, but in vista it turns off Aero and enables ghetto rendering.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.