Tiện ích WEBGL_depth_texture
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Tiện ích WEBGL_depth_texture là một phần của WebGL API và định nghĩa texture độ sâu 2D và texture độ sâu-stencil.
Các tiện ích WebGL có thể dùng bằng phương thức WebGLRenderingContext.getExtension(). Để biết thêm thông tin, xem Using Extensions trong hướng dẫn WebGL.
Hằng số
Tiện ích này thêm một hằng số mới:
ext.UNSIGNED_INT_24_8_WEBGL-
Kiểu số nguyên không dấu cho dữ liệu texture độ sâu 24-bit.
Phương thức mở rộng
Tiện ích này mở rộng WebGLRenderingContext.texImage2D():
- Tham số
formatvàinternalformathiện chấp nhậngl.DEPTH_COMPONENTvàgl.DEPTH_STENCIL. - Tham số
typehiện chấp nhậngl.UNSIGNED_SHORT,gl.UNSIGNED_INT, vàext.UNSIGNED_INT_24_8_WEBGL. - Tham số
pixelshiện chấp nhận đối tượngUint16ArrayhoặcUint32Array.
Tiện ích này mở rộng WebGLRenderingContext.framebufferTexture2D():
- Tham số
attachmenthiện chấp nhậngl.DEPTH_STENCIL_ATTACHMENT.
Ví dụ
js
const ext = gl.getExtension("WEBGL_depth_texture");
gl.texImage2D(
gl.TEXTURE_2D,
0,
gl.DEPTH_COMPONENT,
512,
512,
0,
gl.DEPTH_COMPONENT,
gl.UNSIGNED_SHORT,
null,
);
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| WebGL WEBGL_depth_texture Khronos Ratified Extension Specification> |