- Home /
Why don't I get access to current context with wglGetCurrentContext (OpenGL)
Hi First of all I am trying to adapt the context created by OpenGL in Unity. I am using Windows 10 in combination with an Oculus Rift. My Unity version is 5.6(32-bit) and I am using OpenGLCore.
So I tried to read the context with the help of "wglGetCurrentContext" in a native .dll file but the return value is always NULL. Additionally I have already tried to retrieve the context in the "Start()", "OnPreRender()" and "OnPostRender" functions, without success.
I would really appreciate your help since I am already struggling with this problem for days. Thanks in advance
Answer by Bunny83 · Jul 27, 2018 at 02:10 PM
Rendering happens on a seperate thread, the rendering thread. Most Unity callbacks are executed on the main thread. You may want to have a look at NativePluginInterface as well as LowLevelNativePluginRenderingExtensions