GLCOMPRESSEDTEXSUBIM(3G)
π GLCOMPRESSEDTEXSUBIM(3G) β or, how to slide a compressed 3D subimage into your texture
okay bestie, sit down, because this whole page is literally about glCompressedTexSubImage3D and glCompressedTextureSubImage3D β two icons that let you swap out a chunk of an existing 3D texture with compressed data. the manual name is GLCOMPRESSEDTEXSUBIM(3G), iykyk. π
β¨ NAME β¨
glCompressedTexSubImage3D, glCompressedTextureSubImage3D β specify a three-dimensional texture subimage in a compressed format. yes, that's the whole vibe. π¦
πΈ C SPECIFICATION πΈ
here's the exact signature, do not touch, it's giving sacred text:
void glCompressedTexSubImage3D(GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint zoffset, GLsizei width,
GLsizei height, GLsizei depth,
GLenum format, GLsizei imageSize,
const GLvoid * data);
void glCompressedTextureSubImage3D(GLuint texture, GLint level,
GLint xoffset, GLint yoffset,
GLint zoffset, GLsizei width,
GLsizei height, GLsizei depth,
GLenum format, GLsizei imageSize,
const void *data);
π PARAMETERS π
okay so every single one of these matters, no skipping π
targetβ the target the texture is bound to, for theglCompressedTexSubImage3Dfunction. must beGL_TEXTURE_2D_ARRAY,GL_TEXTURE_3D, orGL_TEXTURE_CUBE_MAP_ARRAY. that's the whole list, periodt.textureβ the texture object name, for theglCompressedTextureSubImage3Dfunction. main character energy.levelβ the level-of-detail number. level0is the base image level. level n is the *n*th mipmap reduction image. tiny-to-big, iconic.xoffsetβ a texel offset in the x direction within the texture array.yoffsetβ a texel offset in the y direction within the texture array.widthβ the width of the texture subimage.heightβ the height of the texture subimage.depthβ the depth of the texture subimage. yes it goes in z too, we're three-dimensional here πformatβ the format of the compressed image data stored at addressdata.imageSizeβ the number of unsigned bytes of image data starting at the address specified bydata. count them. all of them.dataβ a pointer to the compressed image data in memory. the moment.
π DESCRIPTION π
texturing allows elements of an image array to be read by shaders. that's the whole point, bestie, we're feeding the shaders. π§
glCompressedTexSubImage3D and glCompressedTextureSubImage3D redefine a contiguous subregion of an existing three-dimensional texture image. the texels referenced by data replace the portion of the existing texture array with:
- x indices
xoffsetandxoffset + width - 1, and - y indices
yoffsetandyoffset + height - 1, and - z indices
zoffsetandzoffset + depth - 1,
inclusive. highkey it's just a rectangular glow-up for part of your texture. β¨
β οΈ this region may not include any texels outside the range of the texture array as it was originally specified. stay in your lane, subimage.
it is not an error to specify a subtexture with width of 0, but such a specification has no effect. literally nothing happens. a no-op. we respect that.
internalformat must be a known compressed image format (such as GL_RGTC) or an extension-specified compressed-texture format. the format of the compressed texture image is selected by the GL implementation that compressed it (see glTexImage3D()) and should be queried at the time the texture was compressed with glGetTexLevelParameter().
if a non-zero named buffer object is bound to the GL_PIXEL_UNPACK_BUFFER target (see glBindBuffer()) while a texture image is specified, data is treated as a byte offset into the buffer object's data store. sneaky but true. π«Ά
π ERRORS π (vibe check failed edition)
GL_INVALID_ENUMis generated ifinternalformatis one of the generic compressed internal formats:GL_COMPRESSED_RED,GL_COMPRESSED_RG,GL_COMPRESSED_RGB,GL_COMPRESSED_RGBA,GL_COMPRESSED_SRGB, orGL_COMPRESSED_SRGB_ALPHA. the generic ones are a no. πGL_INVALID_ENUMis generated byglCompressedTexSubImage3Diftargetis notGL_TEXTURE_2D_ARRAY,GL_TEXTURE_3D, orGL_TEXTURE_CUBE_MAP_ARRAY.GL_INVALID_OPERATIONis generated byglCompressedTextureSubImage3Diftextureis not the name of an existing texture object.GL_INVALID_VALUEis generated ifimageSizeis not consistent with the format, dimensions, and contents of the specified compressed image data.GL_INVALID_OPERATIONis generated if parameter combinations are not supported by the specific compressed internal format as specified in the specific texture compression extension.GL_INVALID_OPERATIONis generated if a non-zero buffer object name is bound to theGL_PIXEL_UNPACK_BUFFERtarget and the buffer object's data store is currently mapped.GL_INVALID_OPERATIONis generated if a non-zero buffer object name is bound to theGL_PIXEL_UNPACK_BUFFERtarget and the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.- Undefined results, including abnormal program termination, are generated if
datais not encoded in a manner consistent with the extension specification defining the internal compression format. β οΈ like, actual crashing. not cute. read the spec. π
π₯ ASSOCIATED GETS π₯
glGetCompressedTexImage()glGet()with argumentGL_TEXTURE_COMPRESSEDglGet()with argumentGL_PIXEL_UNPACK_BUFFER_BINDINGglGetTexLevelParameter()with argumentsGL_TEXTURE_INTERNAL_FORMATandGL_TEXTURE_COMPRESSED_IMAGE_SIZE
π VERSION SUPPORT π
so the original shipped this as a big table across OpenGL versions 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5 β here it is in list form because tables are not the vibe here, but the facts are identical, no cap:
glCompressedTexSubImage3Dβ β in2.0, β in2.1, β in3.0, β in3.1, β in3.2, β in3.3, β in4.0, β in4.1, β in4.2, β in4.3, β in4.4, β in4.5. she's been slaying since day one. πglCompressedTextureSubImage3Dβ-in2.0,-in2.1,-in3.0,-in3.1,-in3.2,-in3.3,-in4.0,-in4.1,-in4.2,-in4.3,-in4.4, and β in4.5. late arrival, but she ate.
π SEE ALSO π
go read these next, bestie, they're all connected:
glActiveTexture(), glCompressedTexImage1D(), glCompressedTexImage2D(), glCompressedTexImage3D(), glCompressedTexSubImage1D(), glCompressedTexSubImage2D(), glCopyTexImage1D(), glCopyTexImage2D(), glCopyTexSubImage1D(), glCopyTexSubImage2D(), glCopyTexSubImage3D(), glPixelStore(), glTexImage2D(), glTexImage3D(), glTexSubImage1D(), glTexSubImage2D(), glTexSubImage3D(), glTexParameter()
π COPYRIGHT π
Copyright Β© 1991-2006 Silicon Graphics, Inc. Copyright Β© 2010-2014 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.
Copyright Β© 1991-2006 Silicon Graphics, Inc. Copyright Β© 2010-2014 Khronos Group
and that's the page, babes π«Ά the footer said [FIXME: source] with the date 08/09/2021, so shoutout to whoever compiled this in August of 2021 β you're an icon, and a slightly unfinished one, and we love that for you. πβ¨
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms