Failed Swapbuffers and wglMakeCurrent in WinNT/OpenGL app

I am working on an WinNT application that has several opengl windows all sharing a single rendering context, and i have two issues i would like to hear anyones opinion about,

First, I used to have a problem where after doing my rendering i would call SwapBuffers but would fail silently. It would return false, but there would not be any error set when i called GetLastError(). After trying a few different things and reading about CS_OWNDC in some posts i tried it out and the SwapBuffers problem was gone along with some other weird painting when my windows overlapped. I do not however understand fully what the difference is. Could someone explain to me why this might have solved my problem? Does any one know of a link to some page that describes fully how CS_OWNDC affects openGL rendering, that might give some insight as to why this fixed my problem. I am asking because i am not certain that i have fixed the problem and i am wondering if i am just coincidentally masking it or something.

Second, after putting in CS_OWNDC now i am getting a failure of wglMakeCurrent in another part of my application, where i did not use to get a failure before. When i bring up a fifth window that overlaps the other 4 windows it fails, I call GetLastError() and i get the following error: 0x000007d5 The requested clipping operation is not supported. The rendering context and device context are both valid
so i am not sure what is causing this? Anyone have any clues, things that i should check for?

thanks in advance


CS_OWNDC means that each instance of your WNDCLASS has its own, unique device context. This is important, because a rendering context is created for a particular DC. It is very likely that making your windows with CS_OWNDC solved those problems.

As for wglMakeCurrent, you must be certain that the DC you pass to it is either the exact same DC you passed to wglCreateContext or one with the exact same pixel format. If not, then it will fail.

I would suggest that each window have its own RC. Problems can develop if windows start sharing RCs.