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
Specification | Status | Comment |
---|---|---|
WebXR Device API The definition of 'XRWebGLLayerInit.framebufferScaleFactor' in that specification. | Working Draft | Initial definition. |
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论