opentk / GLControl

WinForms control for OpenTK 4.x.
https://opentk.net
Other
54 stars 24 forks source link

makeNoneCurrent function #6

Closed DimaS86 closed 3 years ago

DimaS86 commented 3 years ago

Hello! Thank you for your work. I have an application, which needs to make use of more than one thread for the same opengl context. I have studied a little this question and found out that the issue I was getting is related to the fact that the context can not be set as current in more than one thread at the same time. However, glControl doesn't give any option to call the makeNoneCurrent function, and if I try to call directly makeCurrent function of glControl from another thread, glfw library throws the exception that it can't make the context current. So, what I need to do is to import wglMakeCurrent from opengl32.dll and call it with null parameters to unbind the context, and it works perfectly. Could you please add an option to unbind the context without having to import external libraries? Thanks in advance.

seanofw commented 3 years ago

I'm sorry I missed this message earlier; but have you tried simply calling the MakeNoneCurrent() method on the exposed Context interface? That's not quite as nice as having a built-in method, but it's still pretty simple.

myControl.Context.MakeNoneCurrent();
seanofw commented 3 years ago

Closing this issue due to inactivity.