XRProjectionLayer: textureWidth 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.
Thuộc tính chỉ đọc textureWidth của giao diện XRProjectionLayer cho biết chiều rộng tính bằng pixel của texture màu sắc của layer này.
Chiều rộng texture của projection layer được xác định bởi user agent hoặc thiết bị. Nó được báo cáo trong XRSubImage, chỉ có thể được truy cập bên trong vòng lặp frame. Nếu bạn muốn quản lý các depth buffer của riêng mình và không muốn đợi frame đầu tiên sau khi tạo layer để xác định kích thước cần thiết cho các buffer đó, thuộc tính textureWidth cho phép truy cập chiều rộng texture của layer bên ngoài vòng lặp frame. Việc phân bổ các buffer này có thể xảy ra ngay sau khi tạo layer.
Giá trị
Một số cho biết chiều rộng tính bằng pixel.
Ví dụ
>Sử dụng textureWidth
textureWidth của một layer hữu ích khi tạo render buffer cho một layer. Xem thêm WebGL2RenderingContext.renderbufferStorageMultisample().
let glLayer = xrGLBinding.createProjectionLayer();
let colorRB = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, colorRB);
gl.renderbufferStorageMultisample(
gl.RENDERBUFFER,
samples,
gl.RGBA8,
glLayer.textureWidth,
glLayer.textureHeight,
);
Thông số kỹ thuật
| Specification |
|---|
| WebXR Layers API Level 1> # dom-xrprojectionlayer-texturewidth> |