wglMakeCurrent - The handle is invalid

Started by
2 comments, last by wintertime 10 years, 3 months ago

Hello,

I am fairly new to OpenGL, I don't fully understand everything yet :)
I have a viewer with a context. It is being drawn on the UI which has another separate context. (I am using QT for UI, and trying to draw widgets ontop of viewer.)
wglMakeCurrent() which gets called in the viewer code, fails and says from GetLastError(): wglMakeCurrent() failed. The handle is invalid.
This is how it is called:

...
if (wglMakeCurrent ((HDC )myWindowDC, (HGLRC )myGContext) != TRUE)
...

I uploaded the project if anyone wants to take a look.
What is a likely cause of this?

Advertisement

You could try calling GetLastError() to get a better idea of what is causing the error.

You could try calling GetLastError() to get a better idea of what is causing the error.

Hi Vortez, as I said in my post GetLastError() code returned is : The handle is invalid.

Thanks

As you did not show how you defined myWindowDC and myGContext, and maybe they are classes only containing those handles as member, you may want to remove the typecasts inside the call to avoid hiding an error there. Then you should get a compiler error if that is the problem.

Otherwise look if the context got destroyed somewhere.

This topic is closed to new replies.

Advertisement