这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

WebGL2RenderingContext.compressedTexSubImage3D() 方法在 WebGL API specifies a three-dimensional sub-rectangle for a texture image in a compressed format.

句法

// read from the buffer bound to gl.PIXEL_UNPACK_BUFFER
void gl.compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, offset);
void gl.compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, ArrayBufferView srcData, optional srcOffset, optional srcLengthOverride);
							

参数

target
A GLenum specifying the binding point (target) of the active texture. Possible values:
  • gl.TEXTURE_3D : A three-dimensional texture.
  • gl.TEXTURE_2D_ARRAY : A two-dimensional array texture.
level
A GLint specifying the level of detail. Level 0 is the base image level and level n n th mipmap reduction level.
xoffset
A GLint specifying the x offset within the compressed texture image.
yoffset
A GLint specifying the y offset within the compressed texture image.
zoffset
A GLint specifying the z offset within the compressed texture image.
width
A GLsizei specifying the width of the texture.
height
A GLsizei specifying the height of the texture.
depth
A GLsizei specifying the depth of the texture.
format
A GLenum specifying the compressed image format. Possible values:
  • gl.COMPRESSED_R11_EAC
  • gl.COMPRESSED_SIGNED_R11_EAC
  • gl.COMPRESSED_RG11_EAC
  • gl.COMPRESSED_SIGNED_RG11_EAC
  • gl.COMPRESSED_RGB8_ETC2
  • gl.COMPRESSED_RGBA8_ETC2_EAC
  • gl.COMPRESSED_SRGB8_ETC2
  • gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
  • gl.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
  • gl.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
imageSize
A GLint specifying the number of bytes to read from the buffer bound to gl.PIXEL_UNPACK_BUFFER .
offset
A GLint specifying the offset in bytes from which to read from the buffer bound to gl.PIXEL_UNPACK_BUFFER .
srcData
ArrayBufferView that be used as a data store for the compressed image data in memory.

返回值

None.

范例

gl.compressedTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 512, 512, 512, gl.COMPRESSED_R11_EAC, textureData);
								

规范

规范 状态 注释
WebGL 2.0
The definition of 'compressedTexSubImage3D' in that specification.
编者草案 Initial definition for WebGL.
OpenGL ES 3.0
The definition of 'glCompressedTexSubImage3D' in that specification.
标准 Man page of the (similar) OpenGL ES 3.0 API.

浏览器兼容性

更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
compressedTexSubImage3D Chrome 56 Edge 79 Firefox 51 IE 不支持 No Opera 43 Safari 不支持 No WebView Android 58 Chrome Android 58 Firefox Android 51 Opera Android 43 Safari iOS 不支持 No Samsung Internet Android 7.0

图例

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改:
  1. WebGL API
  2. WebGL2RenderingContext
  3. 方法
    1. beginQuery()
    2. beginTransformFeedback()
    3. bindBufferBase()
    4. bindBufferRange()
    5. bindSampler()
    6. bindTransformFeedback()
    7. bindVertexArray()
    8. blitFramebuffer()
    9. clearBuffer[fiuv]()
    10. clientWaitSync()
    11. compressedTexSubImage3D()
    12. copyBufferSubData()
    13. copyTexSubImage3D()
    14. createQuery()
    15. createSampler()
    16. createTransformFeedback()
    17. createVertexArray()
    18. deleteQuery()
    19. deleteSampler()
    20. deleteSync()
    21. deleteTransformFeedback()
    22. deleteVertexArray()
    23. drawArraysInstanced()
    24. drawBuffers()
    25. drawElementsInstanced()
    26. drawRangeElements()
    27. endQuery()
    28. endTransformFeedback()
    29. fenceSync()
    30. framebufferTextureLayer()
    31. getActiveUniformBlockName()
    32. getActiveUniformBlockParameter()
    33. getActiveUniforms()
    34. getBufferSubData()
    35. getFragDataLocation()
    36. getIndexedParameter()
    37. getInternalformatParameter()
    38. getQuery()
    39. getQueryParameter()
    40. getSamplerParameter()
    41. getSyncParameter()
    42. getTransformFeedbackVarying()
    43. getUniformBlockIndex()
    44. getUniformIndices()
    45. invalidateFramebuffer()
    46. invalidateSubFramebuffer()
    47. isQuery()
    48. isSampler()
    49. isSync()
    50. isTransformFeedback()
    51. isVertexArray()
    52. pauseTransformFeedback()
    53. readBuffer()
    54. renderbufferStorageMultisample()
    55. resumeTransformFeedback()
    56. samplerParameter[if]()
    57. texImage3D()
    58. texStorage2D()
    59. texStorage3D()
    60. texSubImage3D()
    61. transformFeedbackVaryings()
    62. uniform[1234][uif][v]()
    63. uniformBlockBinding()
    64. uniformMatrix[234]x[234]fv()
    65. vertexAttribDivisor()
    66. vertexAttribI4[u]i[v]()
    67. vertexAttribIPointer()
    68. waitSync()
  4. 继承:
    1. WebGLRenderingContext
  5. WebGL 相关页面
    1. ANGLE_instanced_arrays
    2. EXT_blend_minmax
    3. EXT_color_buffer_half_float
    4. EXT_disjoint_timer_query
    5. EXT_frag_depth
    6. EXT_sRGB
    7. EXT_shader_texture_lod
    8. EXT_texture_filter_anisotropic
    9. OES_element_index_uint
    10. OES_standard_derivatives
    11. OES_texture_float
    12. OES_texture_float_linear
    13. OES_texture_half_float
    14. OES_texture_half_float_linear
    15. OES_vertex_array_object
    16. WEBGL_color_buffer_float
    17. WEBGL_compressed_texture_atc
    18. WEBGL_compressed_texture_etc1
    19. WEBGL_compressed_texture_pvrtc
    20. WEBGL_compressed_texture_s3tc
    21. WEBGL_compressed_texture_s3tc_srgb
    22. WEBGL_debug_renderer_info
    23. WEBGL_debug_shaders
    24. WEBGL_depth_texture
    25. WEBGL_draw_buffers
    26. WEBGL_lose_context
    27. WebGLActiveInfo
    28. WebGLBuffer
    29. WebGLContextEvent
    30. WebGLFramebuffer
    31. WebGLObject
    32. WebGLProgram
    33. WebGLQuery
    34. WebGLRenderbuffer
    35. WebGLRenderingContext
    36. WebGLSampler
    37. WebGLShader
    38. WebGLShaderPrecisionFormat
    39. WebGLSync
    40. WebGLTexture
    41. WebGLTransformFeedback
    42. WebGLUniformLocation
    43. WebGLVertexArrayObject