WEBGL_depth_texture 擴充套件
WEBGL_depth_texture 擴充套件是 WebGL API 的一部分,它定義了二維深度紋理和深度-模板紋理。
可以使用 WebGLRenderingContext.getExtension() 方法來訪問 WebGL 擴充套件。有關更多資訊,請參閱 WebGL 教程中的 使用擴充套件。
常量
此擴充套件添加了一個新常量
ext.UNSIGNED_INT_24_8_WEBGL-
24 位深度紋理資料的無符號整數型別。
擴充套件的方法
此擴充套件擴充套件了 WebGLRenderingContext.texImage2D()
format和internalformat引數現在接受gl.DEPTH_COMPONENT和gl.DEPTH_STENCIL。type引數現在接受gl.UNSIGNED_SHORT、gl.UNSIGNED_INT和ext.UNSIGNED_INT_24_8_WEBGL。pixels引數現在接受Uint16Array或Uint32Array物件。
此擴充套件擴充套件了 WebGLRenderingContext.framebufferTexture2D()
attachment引數現在接受gl.DEPTH_STENCIL_ATTACHMENT。
示例
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,
);
規範
| 規範 |
|---|
| WebGL WEBGL_depth_texture Khronos 批准的擴充套件規範 |
瀏覽器相容性
載入中…