GLTEXSUBIMAGE1D(3G)
πΈ NAME πΈ
glTexSubImage1D β bestie's guide to specifying a one-dimensional texture subimage β¨
(yes it's from the GLTEXSUBIMAGE1D(3G) manual, section 3G, we love a GL era icon π
)
π C SPECIFICATION π
void glTexSubImage1D( GLenum target,
GLint level,
GLint xoffset,
GLsizei width,
GLenum format,
GLenum type,
const GLvoid *pixels )
no cap, that's the whole signature, copy it exactly please π
π PARAMETERS π
targetβ which texture we're targeting, okurr. Has to beGL_TEXTURE_1D. No other options, she's picky.levelβ the level-of-detail number, i.e. which mipmap floor we're on. Level0is the base image level. Level n is the *n*th mipmap reduction image. lowkey a whole elevator system πxoffsetβ a texel offset in the x direction, inside the texture array. it's giving "where do I start" energy.widthβ how wide the texture subimage is. the girlies love a width.formatβ specifies the ___ of the pixel data (bestie the original manpage literally has a blank word here π but it's the format, iykyk). accepted symbolic values:GL_COLOR_INDEX,GL_RED,GL_GREEN,GL_BLUE,GL_ALPHA,GL_RGB,GL_BGR,GL_RGBA,GL_BGRA,GL_LUMINANCE, andGL_LUMINANCE_ALPHA. that's the whole roster, no substitutions β¨typeβ the data type of the pixel data. accepted values:GL_UNSIGNED_BYTE,GL_BYTE,GL_BITMAP,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. yes that's all of them, I counted twice π«Άpixelsβ a pointer to the image data in memory. just a lil pointer, doing its best π
π¦ DESCRIPTION π¦
So texturing maps a portion of a specified texture image onto each graphical primitive that has texturing enabled. iconic behavior honestly. To enable or disable one-dimensional texturing, you call glEnable and glDisable with the argument GL_TEXTURE_1D. that's the on/off switch bestie π
glTexSubImage1D redefines a contiguous subregion of an existing one-dimensional texture image. the texels that pixels points to replace the portion of the existing texture array with x indices xoffset and xoffset+widthβ1, inclusive. β
β οΈ This region may not include any texels outside the range of the texture array as it was originally specified. stay in your lane, subimage π
It is not an error to specify a subtexture with width of 0 β but such a specification has no effect. so like, it's legal, it just does nothing. relatable honestly π
β¨ NOTES β¨
glTexSubImage1Dis available only if the GL version is 1.1 or greater. old-GL girlies stay home π- Texturing has no effect in color index mode. periodt.
glPixelStoreandglPixelTransfermodes affect texture images in exactly the way they affectglDrawPixels. same energy, same pipeline π«- Formats
GL_BGR, andGL_BGRAand typesGL_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_REVare available only if the GL version is 1.2 or greater. β¨ the glow-up tier. - When the
GL_ARB_multitextureextension is supported,glTexSubImage1Dspecifies a one-dimensional sub texture for the current texture unit, specified withglActiveTextureARB. main character texture unit energy π - When the
GL_ARB_imagingextension is supported, the RGBA components specified inpixelsmay be processed by the imaging pipeline. SeeglTexImage1Dfor specific details. go read that one bestie, I'm not spoiling it π§
π₯ ERRORS π₯
GL_INVALID_ENUMis generated iftargetis not one of the allowable values. wrong target, girl πGL_INVALID_OPERATIONis generated if the texture array has not been defined by a previousglTexImage1Doperation. you can't sub-image what was never imaged, babe πGL_INVALID_VALUEis generated iflevelis less than0. no negative floors, we go up only π¦GL_INVALID_VALUEmay be generated iflevelis greater thanlog2max, where max is the returned value ofGL_MAX_TEXTURE_SIZE. note the may β it's giving "depends on the implementation" πGL_INVALID_VALUEis generated ifxoffset<βb, or if(xoffset+width)>(wβb), where w is theGL_TEXTURE_WIDTH, and b is the width of theGL_TEXTURE_BORDERof the texture image being modified. note that w includes twice the border width. the border math is real, respect it πGL_INVALID_VALUEis generated ifwidthis less than0. (width of0is fine, we covered that, but negative? jail. π )GL_INVALID_ENUMis generated ifformatis not an accepted constant. check the list above, bestie πGL_INVALID_ENUMis generated iftypeis not a type constant. same vibe check π«ΆGL_INVALID_ENUMis generated iftypeisGL_BITMAPandformatis notGL_COLOR_INDEX. they're a package deal, no cap.GL_INVALID_OPERATIONis generated ifglTexSubImage1Dis executed between the execution ofglBeginand the corresponding execution ofglEnd. do not do this inside a begin/end block, I'm begging πGL_INVALID_OPERATIONis generated iftypeis one ofGL_UNSIGNED_BYTE_3_3_2,GL_UNSIGNED_BYTE_2_3_3_REV,GL_UNSIGNED_SHORT_5_6_5, orGL_UNSIGNED_SHORT_5_6_5_REVandformatis notGL_RGB. those packed types only fwGL_RGBβGL_INVALID_OPERATIONis generated iftypeis one ofGL_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, orGL_UNSIGNED_INT_2_10_10_10_REVandformatis neitherGL_RGBAnorGL_BGRA. four-channel types, four-channel formats, matching outfits only πβ¨
π ASSOCIATED GETS π
glGetTexImageglIsEnabledwith argumentGL_TEXTURE_1D
π SEE ALSO π
glActiveTextureARB(3G), glCopyTexImage1D(3G), glCopyTexImage2D(3G), glCopyTexSubImage1D(3G), glCopyTexSubImage2D(3G), glCopyTexSubImage3D(3G), glDrawPixels(3G), glPixelStore(3G), glPixelTransfer(3G), glTexEnv(3G), glTexGen(3G), glTexImage1D(3G), glTexImage2D(3G), glTexImage3D(3G), glTexParameter(3G), glTexSubImage2D(3G), glTexSubImage3D(3G)
the whole friend group, go say hi π«Άπ
okay that's the whole page bestie, every flag, every constant, every error, nothing skipped, we ate π β¨
this cutie is from the GLTEXSUBIMAGE1D(3G) page (section 3G) β no date on the footer, just the page name, so that's all you're getting from me πΈ 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