Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
treytech's avatar
treytech
Explorer
7 years ago

Integrating OVROverlay with external Unity Plugin

I have an Oculus Go application in Unity 2017.4.1f1 that is using a custom Android plugin to playback video. In my current setup, the Android plugin is creating its own OpenGL context that is shared with the Unity context. I create textures in the plugin that have video data drawn into, then I render those textures over in Unity via an External Texture created with the OpenGL name provided by the plugin. This works fine and dandy, but I'm wanting to render the video frames with the timewarped OVR Layers.

However, as far as I can tell, the Unity integration in OVROverlay.cs is primarily used to render a RenderTexture from Unity, or to render a Texture that is already in the project and/or scene hierarchy. I've tried a few different methods to get it to work with my plugin, and none have worked:
  1. I've tried just simply passing my external textures into the OVRPlugin.EnqueueSubmitLayer call, and I tried setting the layer flag to OVRPlugin.LayerFlags.NoAllocation, which I assume means that the Plugin isn't allocating its own textures, but letting me just pass them in. I just get a distorted black texture where the timewarp layer should be. (Is this because the OpenGL context used by the OVRPlugin isn't sharing textures with my plugin's context?)
  2. I've tried letting the OVRPlugin allocate its own textures, then pass those into my plugin and having it write to the textures. This causes OpenGL errors with flushing and displays nothing in the application.
  3. I've tried letting the OVRPlugin allocate its own textures, then using Graphics.Copy to copy my external plugin textures to the OVRPlugin allocated textures. This would be bad for performance I'm assuming, but also doesn't work and displays nothing in the application.
Has anyone successfully displayed external textures in timewarped layers in Unity? Am I just missing something simple?

1 Reply

Replies have been turned off for this discussion
  • vk10's avatar
    vk10
    Honored Guest
    @treytech : were you able to solve this original problem (with our without 1.29) ? Thanks!