GLGETTEXTURESUBIMAGE(3G)
Okay bestie, welcome to the GLGETTEXTURESUBIMAGE page from the 3G manual β yes, the header has the whole [FIXME: manual] placeholder situation going on, iconic π. Buckle up, we're retrieving a sub-region of a texture image and we're gonna understand it fr fr.
β¨ NAME β¨
glGetTextureSubImage β retrieve a sub-region of a texture image from a texture object π
π§Ύ C SPECIFICATION π§Ύ
void glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset,
GLint yoffset, GLint zoffset, GLsizei width,
GLsizei height, GLsizei depth, GLenum format,
GLenum type, GLsizei bufSize, void *pixels);
πΈ PARAMETERS πΈ
textureβ Specifies the name of the source texture object. Must beGL_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. In specific, buffer and multisample textures are not permitted. Not allowed, bestie π«levelβ Specifies the level-of-detail number. Level0is the base image level. Level$n$is the$n$thmipmap reduction image.xoffsetβ Specifies a texel offset in the x direction within the texture array.yoffsetβ Specifies a texel offset in the y direction within the texture array.zoffsetβ Specifies a texel offset in the z direction within the texture array.widthβ Specifies the width of the texture subimage.heightβ Specifies the height of the texture subimage.depthβ Specifies the depth of the texture subimage.formatβ Specifies the format of the pixel data. The following symbolic values are accepted:GL_RED,GL_RG,GL_RGB,GL_BGR,GL_RGBA,GL_BGRA,GL_DEPTH_COMPONENTandGL_STENCIL_INDEX.typeβ Specifies the data type of the pixel data. The following symbolic values are accepted:GL_UNSIGNED_BYTE,GL_BYTE,GL_UNSIGNED_SHORT,GL_SHORT,GL_UNSIGNED_INT,GL_INT,GL_FLOAT,GL_UNSIGNED_BYTE_3_3_2,GL_UNSIGNED_BYTE_2_3_3_REV,GL_UNSIGNED_SHORT_5_6_5,GL_UNSIGNED_SHORT_5_6_5_REV,GL_UNSIGNED_SHORT_4_4_4_4,GL_UNSIGNED_SHORT_4_4_4_4_REV,GL_UNSIGNED_SHORT_5_5_5_1,GL_UNSIGNED_SHORT_1_5_5_5_REV,GL_UNSIGNED_INT_8_8_8_8,GL_UNSIGNED_INT_8_8_8_8_REV,GL_UNSIGNED_INT_10_10_10_2, andGL_UNSIGNED_INT_2_10_10_10_REV.bufSizeβ Specifies the size of the buffer to receive the retrieved pixel data.pixelsβ Returns the texture subimage. Should be a pointer to an array of the type specified bytype.
π DESCRIPTION π
glGetTextureSubImage returns a texture subimage into pixels.
texture is the name of the source texture object and must not be a buffer or multisample texture. The effective target parameter is the value of GL_TEXTURE_TARGET for texture. Level, format, type and pixels have the same meaning as for glGetTexImage. bufSize is the size of the buffer to receive the retrieved pixel data.
For cube map textures, the behavior is as though GetTextureImage were called, but only texels from the requested cube map faces (selected by zoffset and depth, as described below) were returned.
xoffset, yoffset and zoffset values indicate the position of the subregion to return. width, height and depth indicate the size of the region to return. These parameters have the same meaning as for glTexSubImage3D, though for one- and two-dimensional textures there are extra restrictions, described in the errors section below.
For one-dimensional array textures, yoffset is interpreted as the first layer to access and height is the number of layers to access.
For two-dimensional array textures, zoffset is interpreted as the first layer to access and depth is the number of layers to access.
Cube map textures are treated as an array of six slices in the z-dimension, where the value of zoffset is interpreted as specifying the cube map face for the corresponding layer (as presented in the table below) and depth is the number of faces to access:
- 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
For cube map array textures, zoffset is the first layer-face to access, and depth is the number of layer-faces to access. A layer-face described by $k$ is translated into an array layer and face according to:
$$ layer = \left\lfloor { layer \over 6 } \right\rfloor$$
$$ face = k \bmod 6. $$
Component groups from the specified sub-region are packed and placed into memory as described for glGetTextureImage, starting with the texel at (xoffset, yoffset, zoffset).
π ERRORS π
GL_INVALID_VALUEerror is generated iftextureis not the name of an existing texture object.GL_INVALID_OPERATIONerror is generated iftextureis the name of a buffer or multisample texture.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_VALUEerror is generated if the effective target isGL_TEXTURE_1Dand eitheryoffsetis not zero, orheightis not one.GL_INVALID_VALUEerror is 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_OPERATIONerror is generated if the buffer size required to store the requested data is greater thanbufSize.
π VERSION SUPPORT π
- Function / Feature Name:
glGetTextureSubImage - OpenGL
2.0:- - OpenGL
2.1:- - OpenGL
3.0:- - OpenGL
3.1:- - OpenGL
3.2:- - OpenGL
3.3:- - OpenGL
4.0:- - OpenGL
4.1:- - OpenGL
4.2:- - OpenGL
4.3:- - OpenGL
4.4:- - OpenGL
4.5:β
So yeah, in this chart it's a 4.5 girly β the rest are dashes, no cap β
π¦ SEE ALSO π¦
glGetTexImage()glGetTextureImageglReadPixels()glTexImage1D()glTexImage2D()glTexImage3D()glTexSubImage1D()glTexSubImage2D()glTexSubImage3D()
π 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 π
Copyright Β© 2014 Khronos Group
And that's the whole page, bestie π«Ά β source/version [FIXME: source], date 08/09/2021, manual GLGETTEXTURESUBIMAGE(3G). Bye π
π¦ 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