WEBGL_compressed_texture_etc1 擴充套件
WEBGL_compressed_texture_etc1 擴充套件是 WebGL API 的一部分,它公開了 ETC1 壓縮紋理格式。
壓縮紋理可減少 GPU 儲存紋理所需的記憶體量,從而允許使用更高解析度的紋理或更多相同解析度的紋理。
可以使用 WebGLRenderingContext.getExtension() 方法來訪問 WebGL 擴充套件。有關更多資訊,請參閱 WebGL 教程中的 使用擴充套件。
常量
壓縮紋理格式透過一個常量公開,並可用於 compressedTexImage2D() 方法(請注意,ETC1 **不支援** compressedTexSubImage2D() 方法)。
ext.COMPRESSED_RGB_ETC1_WEBGL-
壓縮 24 位 RGB 資料,不帶 Alpha 通道。
示例
js
const ext = gl.getExtension("WEBGL_compressed_texture_etc1");
const texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.compressedTexImage2D(
gl.TEXTURE_2D,
0,
ext.COMPRESSED_RGB_ETC1_WEBGL,
512,
512,
0,
textureData,
);
規範
| 規範 |
|---|
| WebGL WEBGL_compressed_texture_etc1 擴充套件規範 |
瀏覽器相容性
載入中…