table of contents
GLGETTEXTURESUBIMAGE(3G) | [FIXME: manual] | GLGETTEXTURESUBIMAGE(3G) |
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
level
xoffset
yoffset
zoffset
width
height
depth
format
type
bufSize
pixels
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 | Cube Map Face |
0 | GL_TEXTURE_CUBE_MAP_POSITIVE_X |
1 | GL_TEXTURE_CUBE_MAP_NEGATIVE_X |
2 | GL_TEXTURE_CUBE_MAP_POSITIVE_Y |
3 | GL_TEXTURE_CUBE_MAP_NEGATIVE_Y |
4 | GL_TEXTURE_CUBE_MAP_POSITIVE_Z |
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$$ and $$ 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_VALUE error is generated if texture is not the name of an existing texture object.
GL_INVALID_OPERATION error is generated if texture is the name of a buffer or multisample texture.
GL_INVALID_VALUE is generated if xoffset, yoffset or zoffset are negative.
GL_INVALID_VALUE is generated if xoffset + width is greater than the texture's width, yoffset + height is greater than the texture's height, or zoffset + depth is greater than the texture's depth.
GL_INVALID_VALUE error is generated if the effective target is GL_TEXTURE_1D and either yoffset is not zero, or height is not one.
GL_INVALID_VALUE error is generated if the effective target is GL_TEXTURE_1D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE and either zoffset is not zero, or depth is not one.
GL_INVALID_OPERATION error is generated if the buffer size required to store the requested data is greater than bufSize.
VERSION SUPPORT¶
OpenGL Version | ||||||||||||
Function / Feature Name | 2.0 | 2.1 | 3.0 | 3.1 | 3.2 | 3.3 | 4.0 | 4.1 | 4.2 | 4.3 | 4.4 | 4.5 |
glGetTextureSubImage | - | - | - | - | - | - | - | - | - | - | - | ✔ |
SEE ALSO¶
glGetTexImage(),
glGetTextureImage, glReadPixels(), 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
08/09/2021 | [FIXME: source] |