GLGETCOMPRESSEDTEXTU(3G)
π NAME
okay so bestie, this one is glGetCompressedTextureSubImage β it grabs you a sub-region of a compressed texture image out of a compressed texture object. not the whole thing, just the slice you asked for. iconic behavior honestly β¨
(it's from the 3G manual, the OpenGL one, in case you were wondering π)
πΈ C SPECIFICATION
void glGetCompressedTextureSubImage(GLuint texture, GLint level,
GLint xoffset, GLint yoffset,
GLint zoffset, GLsizei width,
GLsizei height, GLsizei depth,
GLsizei bufSize, void *pixels);
like, that's the whole signature, no cap π«Ά
β¨ PARAMETERS
textureβ the name of the source texture object. it must be one ofGL_TEXTURE_1D,GL_TEXTURE_1D_ARRAY,GL_TEXTURE_2D,GL_TEXTURE_2D_ARRAY,GL_TEXTURE_3D,GL_TEXTURE_CUBE_MAP,GL_TEXTURE_CUBE_MAP_ARRAYorGL_TEXTURE_RECTANGLE. and in specific β buffer and multisample textures are not permitted, sorry bestie πlevelβ the level-of-detail number, aka which mipmap we're talking about. level 0 is the base image level, and level n is the *n*th mipmap reduction image. so level 0 is the main character πxoffsetβ the texel offset in the x direction within the texture array.yoffsetβ the texel offset in the y direction within the texture array.zoffsetβ the texel offset in the z direction within the texture array.widthβ the width of the texture subimage. must be a multiple of the compressed block's width, unless the offset is zero and the size equals the texture image size. (that exception is doing a lot of work, lowkey π)heightβ the height of the texture subimage. must be a multiple of the compressed block's height, unless the offset is zero and the size equals the texture image size.depthβ the depth of the texture subimage. must be a multiple of the compressed block's depth, unless the offset is zero and the size equals the texture image size.bufSizeβ the size of the buffer that receives the retrieved pixel data. don't skimp on this one fr fr.pixelsβ returns the texture subimage. should be a pointer to an array of the type specified bytype. π
π¦ DESCRIPTION
so glGetCompressedTextureSubImage lets you obtain a sub-region of a compressed texture image instead of the whole entire image β as long as the compressed data are arranged into fixed-size blocks of texels. that's the catch, that's the vibe check π§
texture is the name of the texture object, and it must not be a buffer or multisample texture. the effective target is the value of GL_TEXTURE_TARGET for texture. level and pixels have the same meaning as the corresponding arguments of glCompressedTexSubImage3D. and bufSize indicates the size of the buffer to receive the retrieved pixel data. slay π
for cube map textures, the behavior is as though glGetCompressedTexImage were called once for each requested face (selected by zoffset and depth, as described below) with target corresponding to the requested texture cube map face as indicated by the table presented below. pixels is offset appropriately for each successive image. okay so here's the layer-to-face mapping, bestie, memorize it:
- Layer number
0βGL_TEXTURE_CUBE_MAP_POSITIVE_X - Layer number
1βGL_TEXTURE_CUBE_MAP_NEGATIVE_X - Layer number
2βGL_TEXTURE_CUBE_MAP_POSITIVE_Y - Layer number
3βGL_TEXTURE_CUBE_MAP_NEGATIVE_Y - Layer number
4βGL_TEXTURE_CUBE_MAP_POSITIVE_Z - Layer number
5βGL_TEXTURE_CUBE_MAP_NEGATIVE_Z
xoffset, yoffset and zoffset indicate the position of the subregion to return. width, height and depth indicate the size of the region to return. these arguments have the same meaning as for glCompressedTexSubImage3D, though there are extra restrictions β described in the errors section below, so like, read it π
the mapping between the xoffset, yoffset, zoffset, width, height and depth parameters and the faces, layers, and layer-faces for cube map, array, and cube map array textures is the same as for glGetTextureSubImage.
the xoffset, yoffset, zoffset offsets and width, height and depth sizes must be multiples of the values of GL_PACK_COMPRESSED_BLOCK_WIDTH, GL_PACK_COMPRESSED_BLOCK_HEIGHT, and GL_PACK_COMPRESSED_BLOCK_DEPTH respectively β unless offset is zero and the corresponding size is the same as the texture size in that dimension. yes, every single one. no shortcuts π₯
pixel storage modes are treated as for glGetCompressedTexSubImage. the texel at (xoffset, yoffset, zoffset) will be stored at the location indicated by pixels and the current pixel packing parameters. periodt. β
π ERRORS
like, be careful out here. here's every way to mess this up:
GL_INVALID_OPERATIONis generated iftextureis the name of a buffer or multisample texture.GL_INVALID_OPERATIONis generated if the buffer size required to store the requested data is greater thanbufSize.GL_INVALID_OPERATIONis generated if the texture compression format is not based on fixed-size blocks.GL_INVALID_VALUEis generated iftextureis not the name of an existing texture object.GL_INVALID_VALUEis generated ifxoffset,yoffsetorzoffsetare negative.GL_INVALID_VALUEis generated ifxoffset+widthis greater than the texture's width,yoffset+heightis greater than the texture's height, orzoffset+depthis greater than the texture's depth.GL_INVALID_VALUEis generated if the effective target isGL_TEXTURE_1Dand eitheryoffsetis not zero, orheightis not one.GL_INVALID_VALUEis generated if the effective target isGL_TEXTURE_1D,GL_TEXTURE_1D_ARRAY,GL_TEXTURE_2DorGL_TEXTURE_RECTANGLEand eitherzoffsetis not zero, ordepthis not one.GL_INVALID_VALUEis generated ifxoffset,yoffsetorzoffsetis not a multiple of the compressed block width, height or depth respectively.GL_INVALID_VALUEis generated ifwidth,heightordepthis not a multiple of the compressed block width, height or depth respectively, unless the offset is zero and the size equals the texture image size.
not me listing ten error conditions π but like, genuinely, read them. they will find you.
π VERSION SUPPORT
okay so here's the moment of truth, the whole grid, bestie. function name is glGetCompressedTextureSubImage, and across every OpenGL version column:
- 2.0 β
- - 2.1 β
- - 3.0 β
- - 3.1 β
- - 3.2 β
- - 3.3 β
- - 4.0 β
- - 4.1 β
- - 4.2 β
- - 4.3 β
- - 4.4 β
- - 4.5 β
β
so yeah. it's giving 4.5 exclusive. 4.5 only. nothing before it, not even a little. she arrived late and she ate ππ
π SEE ALSO
go read these too, iykyk:
glCompressedTexImage1D()glCompressedTexImage2D()glCompressedTexImage3D()glCompressedTexSubImage1D()glCompressedTexSubImage2D()glCompressedTexSubImage3D()glGetCompressedTexImage()glGetCompressedTextureImageglReadPixels()
π COPYRIGHT
Copyright Β© 2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
Copyright Β© 2014 Khronos Group
okay that's the whole page bestie, go forth and pull those compressed sub-images π¦β¨
source: [FIXME: source] Β· dated 08/09/2021 Β· page GLGETCOMPRESSEDTEXTU(3G) β mwah, ily, drink some water ππ
π¦ 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