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

SpecificationStatusComment
WebXR Device API
The definition of 'XRWebGLLayerInit.antialias' in that specification.
Working DraftInitial definition.

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:71 次

字数:4041

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文