Reputation: 3509
I initialize my code normally, and get a valid device / render context, and then store those two in a static object of type OpenGL_Display. When I then call the image update function from outside the DLL, the call to both
wglGetCurrentContext()
as well as wglGetCurrentDC()
return NULL.
When I call wglMakeCurrent()
with the HDC
and HRC
stored in my class, GetLastError()
will return error 170 (The requested resource is in use.)
I don't understand how the resource could be in use from any where. Note that the code runs fine from a .exe, so it has something to do with me calling it from a C# Application, or that it is in a DLL in the first place, but for the life of me I cannot figure out why those resources are busy.
Upvotes: 1
Views: 2670
Reputation: 3078
If you want to use OpenGL from a C# application (I assume .NET framework) then you should use OpenTK.
Upvotes: -1
Reputation: 16582
This error is returned when the context is active in another thread.
Most likely is that your creation/initialisation code does a wglMakeCurrent()
, but does not set the context back to NULL before returning.
If the drawing then occurs on a different thread, it will be unable to set the context and will return ERROR_BUSY.
Upvotes: 8