wglMakeCurrent() & "clipping operation not supported"

Hi Folks,

I’m working on a 3D Chemistry application for Windows. It’s single-threaded MFC, using the MDI model. When rendering into a view, I am calling “wglMakeCurrent()”, and getting the following error:

“Clipping operation not supported”

I’m not sure what is causing this. The error happens when calling wglMakeCurrent() later in the program after the context has been created and made current for the first time. I do this before rendering a view to make sure that the correct context is being used in the case where there is more than one view.

I’ve read in MSDN that “GDI transformation and clipping in hdc are not supported by the rendering context”, but I’m not sure how this applies. As far as I know, there is no clipping being requested.

I’ve had success with a single view when only calling wglMakeCurrent() once after creating the context, and never after that.

Thanks for any help; I’m still learning about Win32 & MFC programming.


It’s better to make current when you be using gl in a function and then make it uncurrent when function is about to return. It is safer for certain hardware.

I’m not sure if that is related to your problem. It sounds like you didnt create the right type of child (clipchildren???, owndc, …)


I haven’t done Windows in a while, so I may be way off base here, but are you trying to use the HDC from the PAINTSTRUCT while handling WM_PAINT? ISTR that it has a clip region corresponding to the rectangle which needs to be repainted, which may result in the error which you describe.