Get to know MDN better
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The read-only XRWebGLLayer property framebuffer is an opaque WebGLFramebuffer which is used to buffer the rendered image if the XR compositor is being used. Otherwise, this property's value is null. The opaque framebuffer is functionally nearly the same as a standard WebGL framebuffer, except for the differences covered in the section How opaque framebuffers are special below.
A WebGLFramebuffer object representing the framebuffer into which the 3D scene is being rendered, or null if the XR compositor is disabled for the session.
The framebuffer represented by the framebuffer property is opaque. As such, its behavior is different in several ways from a standard WebGL context. These differences cause the opaque framebuffer to behave more like the default WebGL framebuffer:
Note: The depth and stencil properties are not required to be supported in order for a browser to be construed as having full WebGL support.
Upon creating a new XRWebGLLayer, its new framebuffer is initialized just like the default framebuffer for any WebGL interface:
This example gets the XRWebGLLayer for a session and then passes its framebuffer into the WebGL context's bindFramebuffer() function.
| WebXR Device API # dom-xrwebgllayer-framebuffer |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Oct 28, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.