Search completed in 1.72 seconds.
8 results for "xrCompatible":
WebGLRenderingContext.makeXRCompatible() - Web APIs
the webglrenderingcontext method make
xrcompatible() ensures that the rendering context described by the webglrenderingcontext is ready to render the scene for the immersive webxr device on which it will be displayed.
... syntax let makecompatpromise = webglrenderingcontext.make
xrcompatible(); parameters none.
... usage notes because make
xrcompatible() may involve replacing the underlying webgl context with a new one that uses the new rendering hardware, the existing contents of the context may be lost and, therefore, would need to be re-rendered.
...And 2 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
function sessionstarted(session) { let refspacetype; xrsession = session; xrbutton.innertext = "exit webxr"; xrsession.addeventlistener("end", sessionended); let canvas = document.queryselector("canvas"); gl = canvas.getcontext("webgl", {
xrcompatible: true }); if (allowmouserotation) { canvas.addeventlistener("pointermove", handlepointermove); canvas.addeventlistener("contextmenu", (event) => { event.preventdefault(); }); } if (allowkeyboardmotion) { document.addeventlistener("keydown", handlekeydown); } shaderprogram = initshaderprogram(gl, vssource, fssource); programinfo = { program: shaderprogram, attri...
...the
xrcompatible property is requested when calling getcontext() on the element to gain access to the webgl rendering context for the canvas.
Starting up and shutting down a WebXR session - Web APIs
in basic form, code to do this final setup might look something like this: async function runsession(session) { let worlddata; session.addeventlistener("end", onsessionend); let canvas = document.queryselector("canvas"); gl = canvas.getcontext("webgl", {
xrcompatible: true }); // set up webgl data and such worlddata = loadglprograms(session, "worlddata.xml"); if (!worlddata) { return null; } // finish configuring webgl worlddata.session.updaterenderstate({ baselayer: new xrwebgllayer(worlddata.session, gl) }); // start rendering the scene referencespace = await worlddata.session.requestreferencespace("unbounded"); worlddata.r...
...then the rendering canvas is obtained and a reference to its webgl context is retrieved, specifying the
xrcompatible option when calling getcontext().
WebGLRenderingContext - Web APIs
webglrenderingcontext.make
xrcompatible() ensures the context is compatible with the user's xr hardware, re-creating the context if necessary with a new configuration to do so.
WebXR Device API - Web APIs
if the context was not initially created with the
xrcompatible property set to true, you must call make
xrcompatible() prior to attempting to use the webgl context for webxr rendering.
XRRenderState.baseLayer - Web APIs
examples you can set the xrwebgllayer used for rendering by calling updaterenderstate(), like this: let canvas = document.queryselector("canvas"); gl = canvas.getcontext("webgl", {
xrcompatible: true }); setnewwebgllayer(); function setnewwebgllayer(gl) { if (!gl) { /* webgl not available */ return; } xrsession.updaterenderstate({ baselayer: new xrwebgllayer(xrsession, gl); }); }; here, the canvas obtained in the first line is the canvas into which webgl is going to draw.
XRSession.updateRenderState() - Web APIs
function onxrsessionstarted(xrsession) { let glcanvas = document.createelement("canvas"); let gl = glcanvas.getcontext("webgl", {
xrcompatible: true }); loadwebglresources(); xrsession.updaterenderstate({ baselayer: new xrwebgllayer(xrsession, gl) }); } specifications specification status comment webxr device apithe definition of 'xrsession.updaterenderstate()' in that specification.
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
examples in this example, we request a frame buffer at the device's native resolution, regardless of any performance concerns: function requestnativescalewebgllayer(gl, xrsession) { return gl.make
xrcompatible().then(() => { let scalefactor = xrwebgllayer.getnativeframebufferscalefactor(xrsession); let gllayer = new xrwebgllayer(xrsession, gl, { framebufferscalefactor: scalefactor }); xrsession.updaterenderstate({ baselayer: gllayer }); }); }; this starts by calling the webgl rendering context function make
xrcompatible().