XRWebGLLayerInit.antialias - Web APIs 编辑
Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The Boolean antialias
property, if present and set to true
in the XRWebGLLayerInit
object provided as the XRWebGLLayer()
constructor's layerInit
parameter, requests that the new WebGL rendering layer support anti-aliasing. If this property is missing or is false
, anti-aliasing is not desired.
There is no way to request a specific anti-aliasing format or level; this decision is left up to the user agent.
Syntax
let layerInit = { antialias: boolValue }; let glLayer = new XRWebGLLayer(xrSession, gl, layerInit); let glLayer = new XRWebGLLayer(xrSession, gl, { antialias: boolValue });
Value
A Boolean value which can be set to true
to request anti-aliasing support in the new WebGL rendering layer. If false
, anti-aliasing is not desired.
Usage notes
The state of anti-aliasing for the context after being created can be read from the XRWebGLLayer
property antialias
.
Example
In this example, before creating a new XRWebGLLayer
to use for rendering, the value of a user preference from a configuration interface is obtained using a function called getPreferenceValue()
to determine whether the user has enabled or disabled anti-aliasing support; this is passed into the constructor.
let options = {
antialias: getPreferenceValue("antialiasing")
};
let glLayer = new XRWebGLLayer(xrSession, gl, options);
if (glLayer) {
xrSession.updateRenderState({ baseLayer: glLayer });
}
Offering the user features such as the ability to enable or disable things like anti-aliasing can provide them with optiions to try when your app isn't performing as well as they'd like. Disabling anti-aliasing may improve performance to some extent.
Specifications
Specification | Status | Comment |
---|---|---|
WebXR Device API The definition of 'XRWebGLLayerInit.antialias' in that specification. | Working Draft | Initial definition. |
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论