XRWebGLLayer: framebufferWidth property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Thuộc tính chỉ đọc framebufferWidth của XRWebGLLayer chỉ định chiều rộng của framebuffer, tính bằng pixel.
Bạn có thể lấy chiều cao của framebuffer bằng thuộc tính framebufferHeight.
Giá trị
Chiều rộng tính bằng pixel của framebuffer của thiết bị XR. Mỗi attachment của framebuffer (pixel, bộ đệm độ sâu, màu và/hoặc bộ đệm stencil, ví dụ) đều rộng bằng số pixel này.
Ví dụ
Đoạn mã này lấy chiều rộng và chiều cao của framebuffer để sử dụng sau.
let glLayer = xrSession.renderState.baseLayer;
gl.bindFramebuffer(gl.FRAMEBUFFER, glLayer.framebuffer);
frameWidth = glLayer.framebufferWidth;
frameHeight = glLayer.framebufferHeight;
Thông số kỹ thuật
| Specification |
|---|
| WebXR Device API> # dom-xrwebgllayer-framebufferwidth> |