XRWebGLLayerInit.alpha

Secure context
This 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 API
The definition of 'XRWebGLLayerInit.alpha' in that specification.
Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
alphaChrome Full support 79Edge Full support 79Firefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android Full support 79Chrome Android Full support 79Firefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android Full support 11.2

Legend

Full support  
Full support
No support  
No support

See also