I am writing a plugin that needs to create a shared OpenGL context with Unity. That works perfectly fine for Unity apps as well as for Google Cardboard apps. As soon as I activate “Virtual Reality Supported” it fails to write to the texture.
Is there anything special to support shared context with “Virtual Reality Supported”? When is the VR context created, does it work with native plugins?
When Virtual Reality Supported is true and GearVR or Oculus is the target, the Oculus Plugin actually takes over the Unity Context. So you would have to share the Context that the Oculus Plugin has at that point. Which may not be safe. Oculus has updated their native plugin API to resolve this, so they will soon no longer be taking control of our Context.
There is not need to activate “Virtual Reality Supported” for Cardboard app.
How do you shared OpenGL context with Unity? In Android, I use eglGetCurrentContext() to get unity context which used to eglCreateContext(), but the texture is not work.