WEBGL_compressed_texture_pvrtc
扩展属于
WebGL API
and exposes four
PVRTC compressed texture formats
.
Compressed textures reduce the amount of memory needed to store a texture on the GPU, allowing for higher resolution textures or more of the same resolution textures.
WebGL extensions are available using the
WebGLRenderingContext.getExtension()
method. For more information, see also
使用扩展
在
WebGL 教程
.
可用性: PVRTC is typically only available on mobile devices with PowerVR chipsets. It is used in all generations of the iPhone, iPod Touch and iPad and supported on certain Android devices that use a PowerVR GPU.
This extension is available to both, WebGL1 and WebGL2 上下文。
注意
: On iOS devices, this extension is named
WEBKIT_WEBGL_compressed_texture_pvrtc
.
The compressed texture formats are exposed by four constants and can be used in two functions:
compressedTexImage2D()
(where the
height
and
width
parameters must be powers of 2) and
compressedTexSubImage2D()
(where the the height and width parameters must equal the current values of the existing texture and the
xoffset
and
yoffset
parameters must be 0).
ext.COMPRESSED_RGB_PVRTC_4BPPV1_IMG
RGB compression in 4-bit mode. One block for each 4×4 pixels.
ext.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
RGBA compression in 4-bit mode. One block for each 4×4 pixels.
ext.COMPRESSED_RGB_PVRTC_2BPPV1_IMG
RGB compression in 2-bit mode. One block for each 8×4 pixels.
ext.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
RGBA compression in 2-bit mode. One block for each 8×4 pixels.
var ext = gl.getExtension('WEBGL_compressed_texture_pvrtc');
var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ext.COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 512, 512, 0, textureData);
| 规范 | 状态 | 注释 |
|---|---|---|
|
WEBGL_compressed_texture_pvrtc
The definition of 'WEBGL_compressed_texture_pvrtc' in that specification. |
草案 | 初始定义。 |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
更新 GitHub 上的兼容性数据| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
WEBGL_compressed_texture_pvrtc
|
Chrome Yes | Edge 79 |
Firefox
18
|
IE ? | Opera Yes | Safari ? | WebView Android Yes | Chrome Android Yes | Firefox Android ? | Opera Android Yes | Safari iOS ? | Samsung Internet Android Yes |
完整支持
兼容性未知
要求使用供应商前缀或不同名称。
WebGLRenderingContext.getExtension()
WebGLRenderingContext.compressedTexImage2D()
WebGLRenderingContext.compressedTexSubImage2D()
WebGLRenderingContext.getParameter()
WEBGL_compressed_texture_pvrtc
ANGLE_instanced_arrays
EXT_blend_minmax
EXT_color_buffer_half_float
EXT_disjoint_timer_query
EXT_frag_depth
EXT_sRGB
EXT_shader_texture_lod
EXT_texture_filter_anisotropic
OES_element_index_uint
OES_standard_derivatives
OES_texture_float
OES_texture_float_linear
OES_texture_half_float
OES_texture_half_float_linear
OES_vertex_array_object
WEBGL_color_buffer_float
WEBGL_compressed_texture_atc
WEBGL_compressed_texture_etc1
WEBGL_compressed_texture_s3tc
WEBGL_compressed_texture_s3tc_srgb
WEBGL_debug_renderer_info
WEBGL_debug_shaders
WEBGL_depth_texture
WEBGL_draw_buffers
WEBGL_lose_context
WebGL2RenderingContext
WebGLActiveInfo
WebGLBuffer
WebGLContextEvent
WebGLFramebuffer
WebGLObject
WebGLProgram
WebGLQuery
WebGLRenderbuffer
WebGLRenderingContext
WebGLSampler
WebGLShader
WebGLShaderPrecisionFormat
WebGLSync
WebGLTexture
WebGLTransformFeedback
WebGLUniformLocation
WebGLVertexArrayObject