安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
只读
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
下文。
let framebuffer = xrWebGLLayer.framebuffer;
A
WebGLFramebuffer
object representing the framebuffer into which the 3D scene is being rendered, or
null
若
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:
framebufferTexture2D()
,
framebufferRenderbuffer()
,
deleteFramebuffer()
,或
getFramebufferAttachmentParameter()
on an opaque framebuffer results in the WebGL error
INVALID_OPERATION
(0x0502).
requestAnimationFrame()
callback. Attempting to clear, draw to, or read from the framebuffer results in a WebGL
INVALID_FRAMEBUFFER_OPERATION
error (0x0506). Calling
checkFramebufferStatus()
on the WebGL context from outside the animation frame callback causes the WebGL
FRAMEBUFFER_UNSUPPORTED
error (0x8CDD) to be reported.
depth
特性被设为
false
will not have a depth buffer and will rely on the coordinates alone to determine distance.
stencil
will not have a stencil buffer.
alpha
特性为
true
when creating the layer.
premultipliedAlpha
context attribute is set.
注意:
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()
函数。
let glLayer = xrSession.renderState.baselayer; gl.bindFramebuffer(gl.FRAMEBUFFER, glLayer.framebuffer);
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebXR 设备 API
The definition of 'XRWebGLLayer.framebuffer' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
framebuffer
|
Chrome 79 | Edge 79 | Firefox No | IE No | Opera No | Safari No | WebView Android No | Chrome Android 79 | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android 11.2 |
完整支持
不支持
XRWebGLLayer
framebuffer
framebufferHeight
framebufferWidth
ignoreDepthValues
Navigator.xr
WebGLRenderingContext.makeXRCompatible()
XR
XRBoundedReferenceSpace
XRFrame
XRInputSource
XRInputSourceArray
XRInputSourceEvent
XRInputSourcesChangeEvent
XRPose
XRReferenceSpace
XRReferenceSpaceEvent
XRRenderState
XRRigidTransform
XRSession
XRSessionEvent
XRSpace
XRView
XRViewerPose
XRViewport