Jump to content
  • Advertisement
Sign in to follow this  
scarecr0w132

OpenGL wglMakeCurrent - The handle is invalid

This topic is 2115 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

 

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!