Back to Content

XRDepthInformation: width property

files/en-us/web/api/xrdepthinformation/width/index.md

latest767 B
Original Source

{{APIRef("WebXR Device API")}}{{SeeCompatTable}}{{SecureContext_Header}}

The read-only width property of the {{DOMxRef("XRDepthInformation")}} interface contains the width of the depth buffer (number of columns).

Value

An unsigned long integer.

Examples

Use {{domxref("XRFrame.getDepthInformation()")}} (CPU) or {{domxref("XRWebGLBinding.getDepthInformation()")}} (WebGL) to obtain depth information. The returned objects will contain the width of the depth buffer, which you can use for further calculations.

js
const smallerDepthDimension = Math.min(depthInfo.width, depthInfo.height);
const largerDepthDimension = Math.max(depthInfo.width, depthInfo.height);

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}