XRWebGLLayerInit.stencil - Web APIs 编辑
Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
When using the XRWebGLLayer()
constructor to create a new WebGL rendering layer for WebXR, providing as the layerInit
parameter an object whose stencil
property is false
requests that the new layer be created without a stencil buffer.
The stencil buffer is an optional buffer which, just like the depth buffer, contains one entry for every pixel in the frame buffer. Also just like the depth buffer, the value of an enter in the stencil buffer directly affects how (or if) the corresponding pixel is drawn during rendering. You can store values into each entry in the stencil bufer, then specify an operation that determines which stencil buffer values correspond to pixels which should be drawn to the screen during each frame.
Syntax
let layerInit = {
stencil: false
};
let glLayer = new XRWebGLLayer(xrSession, gl, layerInit);
let glLayer = new XRWebGLLayer(xrSession, gl, { stencil: false });
Value
A Boolean which can be set to false
to specify that the new WebGL layer should not include a stencil buffer. The default value is true
.
Example
In this example, a new XRWebGLLayer
is created for a WebXR session, xrSession
, without a stencil buffer.
xrSession.updateRenderState({
baseLayer: new XRWebGLLayer(xrSession, gl, {
stencil: false
});
});
Specifications
Specification | Status | Comment |
---|---|---|
WebXR Device API The definition of 'XRWebGLLayerInit.stencil' in that specification. | Working Draft | Initial definition. |
Browser compatibility
BCD tables only load in the browser
See also
- WebXR Device API
- Getting started with WebGL
- WebGL stenciling methods include:
stencilOp()
,clearStencil()
,stencilFunc()
,stencilMask()
,stencilMaskSeparate()
,stencilFuncSeparate()
,stencilOpSeparate()
,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论