
[Solved] Error : 6 when calling GLControl.MakeCurrent
Posted Monday, 18 May, 2009 - 10:22 by SoundbomberI was getting this error recently after calling GLControl.MakeCurrent.
I was using a single context of GL and multiple GLControls in VB.Net.
The error only ever happened when I had closed the control's parent form and then re-opened it.
Error 6 is a windows Invalid Handle error, so after a little experimenting, I decided to override the GLControls' OnHandleDestroyed event and removed the MyBase call.
Now I don't really know what the implications of doing this may be, but everything seems to work fine now.
Any updates and I will keep posting.
- Soundbomber's blog
- Login or register to post comments


Comments
Re: Error : 6 when calling GLControl.MakeCurrent
So you created your own GLControl class "MyGLControl" via inheritance, and wrote your own version of the OnHandleDestroyed method (overriding the one found in GLControl?)?
Re: Error : 6 when calling GLControl.MakeCurrent
The error: 6 issue was caused by an OpenTK bug that has been fixed in SVN (fix will be available in OpenTK 0.9.8). Under some circumstances, OpenTK would leak device contexts, causing it to run out of DCs after some time.
This workaround works because it stopps OpenTK from executing the leaky code. OpenTK 0.9.8+ should work fine without the workaround.
Please file a bug if you encounter error: 6 when using SVN or OpenTK 0.9.8+.
Re: Error : 6 when calling GLControl.MakeCurrent
Just to confirm that OTK 0.9.8 works fine. No bug.