cables is under heavy development.
There might be one or another bug, please let us know about it!

MainloopWebVr Op


Namespace: Ops.Gl.Vr

Op author: pandur

Uses spanbrary: WebVr Polyfill (A JavaScript implementation of the WebVR spec, e.g. use webvr on phones which browsers don't support it)

experimental webvr rendering / currently not being developed due to XR update

summary (oneliner)

Very experimental op.
Web VR is currently not supported in chrome.
It is supported with Mozilla firefox so we recommend working in that browser when developing for VR.
Will also work on mobile. IOS and android. Make sure to go to your view patch screen and then "open in new window" to be able to press the Vr button.
Can be combined with the screen orientation op to create mobile VR experiences.

NoVR Mainloop is the same as the normal mainloop.
VR Mainloop will render twice, once for each eye, check the example file that uses the the "eye" port output for a basic setup in VR.



youtube id

caniuse query


related ops


Start VR (Trigger)

Start VR mainLoop

Stop VR (Trigger)

Stop VR mainLoop

Scale Resolution (Number)

Scales resolution when Resize canvas is enabled, handy for slower hardware

Resize Canvas (boolean /Number)

When true gets reported resolution from VR headset and sets canvas size to match

use gamepads (boolean /Number)

Enables gamepads / still has to be implemented


VR Mainloop (Trigger)

Trigger out twice, once for each eye per frame. Only works when Start VR is enabled

NoVR Mainloop (Trigger)

Trigger out when VR isn't isn't enabled

width (Number)

Resolution width, will change when resize canvas is on

height (Number)

Resolution height, will change when resize canvas is on

Supported (Number)

Will report true if a VR compatible headset/device is plugged in

Controller support (Number)

Will report true if a VR compatible gamepad/s are plugged in

Controllers amount (Number)

Amount of controllers connected

VR Display (Number)

the name of the connected headset

FPS (Number)

Frames per second

Eye (Number)

0 is the left eye, 1 is the right eye use with the ifTrueThen op to render twice

Gamepad object Left (Object)

Left Gamepad object out , will later work with the VR gamepad op

Gamepad object Right (Object)

Right Gamepad object out , will later work with the VR gamepad op

single trigger out (Trigger)

One trigger out regardless of mode

Left PMatrix (Array)

Left projection Matrix

Started VR (boolean Number)

Outputs true when VR has started

Caught a mistake or want to contribute to the documentation?

Edit Documentationcancel save

VR raycast testbed,Ops.Exp.Gl.Physics.CastRay

Open Example In Editor

Examples using MainloopWebVr ()

Public Patches using MainloopWebVr ()