API

Interface WebXRRenderTarget<TContext, TLayer>

Abstraction of the XR render target. The type parameters default to the WebGL context/layer types, so WebXRRenderTarget used without type arguments keeps the exact same shape as before. A non-WebGL backend (e.g. a future WebGPU/XRGPUBinding target) can specialize the context and layer types.

interface WebXRRenderTarget<
    TContext = WebGLRenderingContext,
    TLayer extends XRLayer = XRWebGLLayer,
> {
    canvasContext: TContext;
    xrLayer: Nullable<TLayer>;
    dispose(): void;
    initializeXRLayerAsync(xrSession: XRSession): Promise<TLayer>;
}

Type Parameters

  • TContext = WebGLRenderingContext
  • TLayer extends XRLayer = XRWebGLLayer

Hierarchy (View Summary)

Implemented by

Index
canvasContext: TContext

xrpresent context of the canvas which can be used to display/mirror xr content

xrLayer: Nullable<TLayer>

xr layer for the canvas

  • Initializes an XR layer to be used as the session's baseLayer.

    Parameters

    • xrSession: XRSession

      xr session

    Returns Promise<TLayer>

    a promise that will resolve once the XR Layer has been created