XRWebGLLayerInit.framebufferScaleFactor - Web APIs 编辑

Secure context

This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The XRWebGLLayerInit dictionary's framebufferScaleFactor property, when specified upon instantiating a new XRWebGLLayer using its constructor, XRWebGLLayer(), specifies the scaling factor to use when determining the size of the frame buffer to use when rendering the scene, relative to the default XR device display resolution.

For example, a value of 1.0 indicates that the frame buffer should be the same resolution as the actual display, while a value of 0.5 indicates that the frame buffer should be half the resolution of the display. A value of 2.0, on the other hand, creates a frame buffer whose resolution is double that of the actual display buffer.

There are valid use cases for all of these kinds of scaling. See Managing rendering quality in WebXR performance guide for more information.

You can determine the scaling factor that you would need to apply to match the default frame buffer resolution by using the XRWebGLLayer.getNativeFramebufferScaleFactor() static function.

Syntax

let layerInit = {
  framebufferScaleFactor: scaleFactor
};
let glLayer = new XRWebGLLayer(xrSession, gl, layerInit);

let glLayer = new XRWebGLLayer(xrSession, gl, { framebufferScaleFactor: scaleFactor });

Value

A floating-point value indicating a multiplier to apply to the default frame buffer resolution in order to determine the resolution of the frame buffer for the XRWebGLLayer.

Example

In this example, a new XRWebGLLayer is created for a WebXR session, xrSession, with a frame buffer whose resolution is half that of the default display resolution of the XR device.

xrSession.updateRenderState({
  baseLayer: new XRWebGLLayer(xrSession, gl, {
     framebufferScaleFactor: 0.5
  });
});

Specifications

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

Browser compatibility

BCD tables only load in the browser

See also

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

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

发布评论

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

词条统计

浏览:123 次

字数:4266

最后编辑:7年前

编辑次数:0 次

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