Skip to main content
Version: 12 Dec 2024

YcbcrRenderer

NameSpace: MagicLeap

Implements a renderer for android native & hardware buffers (Vulkan-only).

Inherited by:
UnityEngine.XR.MagicLeap.MLNativeSurfaceYcbcrRenderer,
UnityEngine.XR.MagicLeap.MLWebView.Renderer

Public Methods

void Cleanup

Destroy all resources held by the native rendering plugin.

public void Cleanup()

delegate void OnCleanupCompleteDelegate

public delegate void OnCleanupCompleteDelegate()

delegate void OnFirstFrameRendereredDelegate

public delegate void OnFirstFrameRendereredDelegate()

void Render

Render the latest native buffer onto the provided Unity texture. Should preferably be called every frame.

public void Render()

void SetRenderBuffer

Currently only 1 call after obj instantiation will work

public void SetRenderBuffer(
RenderTexture renderTexture
)

Parameters

TypeNameDescription
RenderTexturerenderTexture

Protected Methods

Initialize

Initialize the native api handle & the graphics command buffers.

protected void Initialize(
bool waitForQueueIdleOnSubmit =false
)

Parameters

TypeNameDescription
boolcolorSpaceColor space to render in

Protected Attributes

gcHandle

GCHandle for the callback user context


protected GCHandle gcHandle;


Public Events

OnCleanupComplete

Event fired on Unity's main thread to indicate that resource cleanup is complete in the native plugin and it is now safe to cleanup associated managed resources like the RenderTexture.

public OnCleanupCompleteDelegate OnCleanupComplete()

OnCleanupComplete_CallbackThread

Event fired on the callback thread to indicate that resource cleanup is complete in the native plugin and it is now safe to cleanup associated managed resources like the RenderTexture.

public OnCleanupCompleteDelegate OnCleanupComplete_CallbackThread()

OnFirstFrameRendered

Event fired to indicate a frame has been rendered on the current RenderTexture for the first time. Apps can use this event to disable UI elements like loading indicators since the RenderTexture will have a valid frame to display.

public OnFirstFrameRendereredDelegate OnFirstFrameRendered()