安全上下文
此特征只可用于 安全上下文 (HTTPS),在某些或所有 支持浏览器 .

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 了解更多信息。

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.

句法

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

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 .

范例

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
  });
});
					

规范

规范 状态 注释
WebXR 设备 API
The definition of 'XRWebGLLayerInit.framebufferScaleFactor' in that specification.
工作草案 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
framebufferScaleFactor Chrome 79 Edge 79 Firefox No IE No Opera No Safari No WebView Android 79 Chrome Android 79 Firefox Android No Opera Android No Safari iOS No Samsung Internet Android 11.2

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: