Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Create a shared OpenGL context in GearVR on Android

Discussion in 'AR/VR (XR) Discussion' started by Schick, Oct 29, 2015.

  1. Schick

    Schick

    Joined:
    Aug 18, 2015
    Posts:
    9
    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?
     
    Last edited: Oct 30, 2015
  2. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    303
    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.
     
  3. 8600862

    8600862

    Joined:
    May 6, 2016
    Posts:
    1
    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.