Web/API/XRWebGLLayerInit/alpha

From Get docs

Secure contextThis feature is available only in secure contexts (HTTPS), in some or all supporting browsers.


The alpha property is a Boolean value which, if present and set to true in the XRWebGLLayerInit dictionary passed into the XRWebGLLayer() constructor, specifies that the new layer's color buffer is to include an alpha channel. Otherwise, the color buffer won't have an alpha channel. The default is true.

Syntax

let layerInit = {
  alpha: boolValue
};
let glLayer = new XRWebGLLayer(xrSession, gl, layerInit);

let glLayer = new XRWebGLLayer(xrSession, gl, { alpha: boolValue });

Value

A Boolean which can be set to true to request that the new WebGL layer for rendering the WebXR scene is to have an alpha channel.

Example

In this example, a new XRWebGLLayer is created for a WebXR session, xrSession, without an alpha channel.

xrSession.updateRenderState({
  baseLayer: new XRWebGLLayer(xrSession, gl, {
     alpha: false
  });
});

Specifications

Specification Status Comment
WebXR Device APIThe definition of 'XRWebGLLayerInit.alpha' in that specification. Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
alpha Chrome

Full support 79

Edge

Full support 79

Firefox

No support No

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

Full support 79

Chrome Android

Full support 79

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

Full support 11.2

Legend

Full support  
Full support
No support  
No support


See also