Skip to content

Trying to avoid additional canvas when mirroring #341

Closed
@TrevorDev

Description

@TrevorDev

I'm on the BabylonJS team and we are working on adding WebXR support. When prototyping I ran into an issue when trying to avoid the use of multiple canvases.

I managed to modify Babylon to get prototypes working 🙏 in chrome canary by following these samples:
https://github.com/immersive-web/webxr-samples/blob/master/magic-window.html
https://github.com/immersive-web/webxr-samples/blob/master/mirroring.html
but am wondering if there is a way to reuse an existing canvas for mirroring/magic window scenarios instead of overlaying canvases like in the samples.

Currently most Babylon projects start with a single canvas and a webGL context to render a scene. When starting to displaying on the hmd in XR I can set the xr device on the existing webGL context to render to the headset with. However, based on the samples, to mirror the display another canvas is needed to be created with a context of xrpresent. Since the original canvas is no longer used for displaying is there any method to use it as the mirroring canvas to avoid the additional complexity of managing multiple canvas/contexts or is there something I'm missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed by pending PRA PR that is in review will resolve this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions