Cant release device context?!

dfi

Golden Member
Apr 20, 2001
1,213
0
0
I'm using win32 and opengl. I've done this before w/o a hitch. But now, I can't release the dc. What could possibly be the cause?

I do the following when the application starts:
GetDC
SetPixelFormat
wglCreateContext
wglMakeCurrent

When the app closes, I do:
wglMakeCurrent(NULL, NULL);
wglDeleteContext
ReleaseDC

I test to see if ReleaseDC is indeed releasing the device context, and it's not. Any ideas?

dfi
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
The only thing that comes to mind is that you must call ReleaseDC from the same thread that called GetDC. Other than that, see what is the return value of ReleaseDC is. If it's 0, indicating the error then call GetLastError() function to see what's up. GetLastError(), btw, will only work on NT kernels. Other than this I'm out of ideas.