GLCOPYTEXSUBIMAGE2D(3G)
πΈ NAME
Okay so this is GLCOPYTEXSUBIMAGE2D(3G) β the 3G section, bestie β and it does exactly one iconic thing: glCopyTexSubImage2D copies a two-dimensional texture subimage. Periodt. π
π» C SPECIFICATION β¨
void glCopyTexSubImage2D( GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint x,
GLint y,
GLsizei width,
GLsizei height )
π PARAMETERS π
targetβ specifies the target texture. It must beGL_TEXTURE_2D, no exceptions, bestie.levelβ specifies the level-of-detail number. Level0is the base image level. Levelnis thenth mipmap 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.x,yβ specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.widthβ specifies the width of the texture subimage.heightβ specifies the height of the texture subimage.
π¦ DESCRIPTION π¦
So glCopyTexSubImage2D replaces a rectangular portion of a two-dimensional texture image with pixels from the current GL_READ_BUFFER β not from main memory, which is the whole plot twist compared to glTexSubImage2D. π
The screen-aligned pixel rectangle with lower left corner at (x, y) and with width width and height height replaces the portion of the texture array with x indices xoffset through xoffset+widthβ1, inclusive, and y indices yoffset through yoffset+heightβ1, inclusive, at the mipmap level specified by level.
The pixels in the rectangle are processed exactly as if glCopyPixels had been called, but the process stops just before final conversion. At this point, all pixel component values are clamped to the range [0, 1] and then converted to the texture's internal for storage in the texel array.
The destination rectangle in the texture array may not include any texels outside the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.
π¨ If any of the pixels within the specified rectangle of the current GL_READ_BUFFER are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined. Not me saying vibe check your read window, but likeβ¦ do that.
No change is made to the internalformat, width, height, or border parameters of the specified texture array or to texel values outside the specified subregion.
π NOTES π
glCopyTexSubImage2Dis available only if the GL version is1.1or greater.- Texturing has no effect in color index mode.
glPixelStoreandglPixelTransfermodes affect texture images in exactly the way they affectglDrawPixels.- When the
GL_ARB_imagingextension is supported, the RGBA components read from the framebuffer may be processed by the imaging pipeline. SeeglTexImage1Dfor specific details.
π ERRORS π
GL_INVALID_ENUMis generated iftargetis notGL_TEXTURE_2D.GL_INVALID_OPERATIONis generated if the texture array has not been defined by a previousglTexImage2DorglCopyTexImage2Doperation.GL_INVALID_VALUEis generated iflevelis less than0.GL_INVALID_VALUEmay be generated iflevelis greater thanlog2max, wheremaxis the returned value ofGL_MAX_TEXTURE_SIZE.GL_INVALID_VALUEis generated ifx<βbor ify<βb, wherebis the border width of the texture array.GL_INVALID_VALUEis generated ifxoffset<βb,(xoffset+width)>(wβb),yoffset<βb, or(yoffset+height)>(hβb), wherewis theGL_TEXTURE_WIDTH,his theGL_TEXTURE_HEIGHT, andbis theGL_TEXTURE_BORDERof the texture image being modified. Note thatwandhinclude twice the border width.GL_INVALID_OPERATIONis generated ifglCopyTexSubImage2Dis executed between the execution ofglBeginand the corresponding execution ofglEnd.
π₯ ASSOCIATED GETS π₯
glGetTexImageglIsEnabledwith argumentGL_TEXTURE_2D
π SEE ALSO π
glCopyPixels(3G)glCopyTexImage1D(3G)glCopyTexImage2D(3G)glCopyTexSubImage1D(3G)glCopyTexSubImage3D(3G)glPixelStore(3G)glPixelTransfer(3G)glReadBuffer(3G)glTexEnv(3G)glTexGen(3G)glTexImage1D(3G)glTexImage2D(3G)glTexImage3D(3G)glTexParameter(3G)glTexSubImage1D(3G)glTexSubImage2D(3G)glTexSubImage3D(3G)
Catch you later, bestie β this was GLCOPYTEXSUBIMAGE2D(3G) from the 3G manual set, and thereβs no separate date stamped on this page. ππ§
π¦ where this page comes from
- opensuse-leap 16.0: Mesa-libGL-devel 24.1.7-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms