GLCOPYTEXSUBIMAGE3D(3G)
π NAME π
glCopyTexSubImage3D β bestie, it copies a three-dimensional texture subimage. that's it, that's the whole vibe. this is page 3G of the manual, welcome π«Ά
π C SPECIFICATION π
void glCopyTexSubImage3D( GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint zoffset,
GLint x,
GLint y,
GLsizei width,
GLsizei height )
like, nine arguments. she's high maintenance but she delivers β¨
πΈ PARAMETERS πΈ
targetβ the target texture, okurrr. must beGL_TEXTURE_3D. no substitutions, no exceptions πlevelβ the level-of-detail number. level0is the base image level, and level n is the *n*th mipmap reduction image. think of it like zoom levels but make it texture.xoffsetβ a texel offset in the x direction within the texture array.yoffsetβ same thing but for y, the texel offset in the y direction within the texture array.zoffsetβ and z! a texel offset in the z direction within the texture array. three dimensions, three offsets, consistent queen πx,yβ the window coordinates of the lower left corner of the rectangular region of pixels you're copying. lower left. not upper left. do not come for me.widthβ the width of the texture subimage.heightβ the height of the texture subimage.
π¦ DESCRIPTION π¦
okay so glCopyTexSubImage3D replaces a rectangular portion of a three-dimensional texture image with pixels from the current GL_READ_BUFFER. and like β this is the whole point β it takes them from there rather than from main memory, which is what glTexSubImage3D does. different energy entirely β¨
the screen-aligned pixel rectangle has its lower left corner at (x, y), with width width and height height, and it 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 z index zoffset and at the mipmap level specified by level. inclusive!! both of them!! write that down π
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. (yes there is a word missing in there between "internal" and "for" β that's the original's business, not mine, i'm just the messenger π)
the destination rectangle in the texture array may not include any texels outside the texture array as it was originally specified, so stay in your lane. it is not an error to specify a subtexture with zero width or height β but such a specification has no effect. so like, you can do it, nothing happens, it's giving "i showed up to the party and stood in the corner".
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. read that again. undefined. we don't know her π
no change is made to the internalformat, width, height, depth, or border parameters of the specified texture array, or to texel values outside the specified subregion. she's polite, she stays in her box π
π NOTES π
glCopyTexSubImage3Dis available only if the GL version is1.2or greater. sorry to the legacy girlies.- texturing has no effect in color index mode. fr fr.
glPixelStoreandglPixelTransfermodes affect texture images in exactly the way they affectglDrawPixels. same treatment, same rules.- when the
GL_ARB_imagingextension is supported, the RGBA components copied from the framebuffer may be processed by the imaging pipeline, as if they were a two-dimensional texture. seeglTexImage2Dfor the specific deets. π
π₯ ERRORS π₯
GL_INVALID_ENUMis generated iftargetis notGL_TEXTURE_3D.GL_INVALID_OPERATIONis generated if the texture array has not been defined by a previousglTexImage3DorglCopyTexImage3Doperation.GL_INVALID_VALUEis generated iflevelis less than0.GL_INVALID_VALUEmay be generated iflevelis greater thanlog2max, where max is the returned value ofGL_MAX_3D_TEXTURE_SIZE.GL_INVALID_VALUEis generated ifx<βbor ify<βb, where b is the border width of the texture array.GL_INVALID_VALUEis generated ifxoffset<βb,(xoffset+width)>(wβb),yoffset<βb,(yoffset+height)>(hβb),zoffset<βb, orzoffset>(dβb), where w is theGL_TEXTURE_WIDTH, h is theGL_TEXTURE_HEIGHT, d is theGL_TEXTURE_DEPTH, and b is theGL_TEXTURE_BORDERof the texture image being modified. and yes β note that w, h, and d include twice the border width. twice!! π«GL_INVALID_OPERATIONis generated ifglCopyTexSubImage3Dis executed between the execution ofglBeginand the corresponding execution ofglEnd. like, do not do that. that's not her moment.
π ASSOCIATED GETS π
glGetTexImageglIsEnabledwith argumentGL_TEXTURE_3D
iykyk π§
β SEE ALSO β
glCopyPixels(3G), glCopyTexImage1D(3G), glCopyTexImage2D(3G), glCopyTexSubImage1D(3G), glCopyTexSubImage2D(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)
the whole friend group, honestly. go read them too π
and that's the page bestie!! π that was GLCOPYTEXSUBIMAGE3D(3G) β yes, page 3G, the same name up top and down here, no notes, iconic behavior only. mwah π
π¦ 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