GLTEXIMAGE1D(3G)
π GLTEXIMAGE1D(3G) π
okay so this is the GLTEXIMAGE1D(3G) page, and yes the header still has a little [FIXME: manual] situation going on β we move regardless π
π NAME π
glTexImage1D β specify a one-dimensional texture image β¨
π C SPECIFICATION π
void glTexImage1D(GLenum target, GLint level, GLint internalformat,
GLsizei width, GLint border, GLenum format,
GLenum type, const GLvoid * data);
π¦ PARAMETERS π¦
targetβ specifies the target texture. It must beGL_TEXTURE_1DorGL_PROXY_TEXTURE_1D.levelβ specifies the level-of-detail number. Level0is the base image level. Levelnis the nth mipmap reduction image.internalformatβ specifies the number of color components in the texture. It must be one of the base internal formats given in Table 1, one of the sized internal formats given in Table 2, or one of the compressed internal formats given in Table 3, below. πwidthβ specifies the width of the texture image. All implementations support texture images that are at least1024texels wide. The height of the 1D texture image is1.borderβ this value must be0. fr fr, it's0.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_RED_INTEGER,GL_RG_INTEGER,GL_RGB_INTEGER,GL_BGR_INTEGER,GL_RGBA_INTEGER,GL_BGRA_INTEGER,GL_STENCIL_INDEX,GL_DEPTH_COMPONENT,GL_DEPTH_STENCIL.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_HALF_FLOAT,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.dataβ specifies a pointer to the image data in memory.
π DESCRIPTION π
Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. To enable and disable one-dimensional texturing, call glEnable() and glDisable with argument GL_TEXTURE_1D.
Texture images are defined with glTexImage1D. The arguments describe the parameters of the texture image, such as width, width of the border, level-of-detail number (see glTexParameter()), and the internal resolution and format used to store the image. The last three arguments describe how the image is represented in memory.
If target is GL_PROXY_TEXTURE_1D, no data is read from data, but all of the texture image state is recalculated, checked for consistency, and checked against the implementation's capabilities. If the implementation cannot handle a texture of the requested texture size, it sets all of the image state to 0, but does not generate an error (see glGetError()). To query for an entire mipmap array, use an image array level greater than or equal to 1. π«Ά
If target is GL_TEXTURE_1D, data is read from data as a sequence of signed or unsigned bytes, shorts, or longs, or single-precision floating-point values, depending on type. These values are grouped into sets of one, two, three, or four values, depending on format, to form elements. Each data byte is treated as eight 1-bit elements, with bit ordering determined by GL_UNPACK_LSB_FIRST (see glPixelStore()).
If a non-zero named buffer object is bound to the GL_PIXEL_UNPACK_BUFFER target (see glBindBuffer()) while a texture image is specified, data is treated as a byte offset into the buffer object's data store.
The first element corresponds to the left end of the texture array. Subsequent elements progress left-to-right through the remaining texels in the texture array. The final element corresponds to the right end of the texture array. β¨
format determines the composition of each element in data. It can assume one of these symbolic values:
GL_REDβ each element is a single red component. The GL converts it to floating point and assembles it into an RGBA element by attaching0for green and blue, and1for alpha. Each component is clamped to the range[0,1].GL_RGβ each element is a single red/green double. The GL converts it to floating point and assembles it into an RGBA element by attaching0for blue, and1for alpha. Each component is clamped to the range[0,1].GL_RGB,GL_BGRβ each element is an RGB triple. The GL converts it to floating point and assembles it into an RGBA element by attaching1for alpha. Each component is clamped to the range[0,1].GL_RGBA,GL_BGRAβ each element contains all four components. Each component is clamped to the range[0,1].GL_DEPTH_COMPONENTβ each element is a single depth value. The GL converts it to floating point and clamps to the range[0,1].
If an application wants to store the texture at a certain resolution or in a certain format, it can request the resolution and format with internalformat. The GL will choose an internal representation that closely approximates that requested by internalformat, but it may not match exactly. (The representations specified by GL_RED, GL_RG, GL_RGB and GL_RGBA must match exactly.) π₯
internalformat may be one of the base internal formats shown in Table 1, below.
π Table 1. Base Internal Formats π
The columns are Base Internal Format, RGBA, Depth and Stencil Values, and Internal Components:
GL_DEPTH_COMPONENTβ RGBA, Depth and Stencil Values: Depth Β· Internal Components:DGL_DEPTH_STENCILβ RGBA, Depth and Stencil Values: Depth, Stencil Β· Internal Components:D,SGL_REDβ RGBA, Depth and Stencil Values: Red Β· Internal Components:RGL_RGβ RGBA, Depth and Stencil Values: Red, Green Β· Internal Components:R,GGL_RGBβ RGBA, Depth and Stencil Values: Red, Green, Blue Β· Internal Components:R,G,BGL_RGBAβ RGBA, Depth and Stencil Values: Red, Green, Blue, Alpha Β· Internal Components:R,G,B,A
internalformat may also be one of the sized internal formats shown in Table 2, below.
β¨ Table 2. Sized Internal Formats β¨
Okay bestie, this is the big one β the sized internal formats table. Read it like a menu π. Every row has a Sized Internal Format, a Base Internal Format, and then some bit counts: Red Bits, Green Bits, Blue Bits, Alpha Bits, and Shared Bits.
Quick vibe check before you scroll: the Shared Bits column is empty for literally every single row here π. Not one of them fills it in. So I'm just gonna skip writing "Shared Bits: β" fifty times and you can trust me that it's blank all the way down π«Ά.
Also, the bit counts are written exactly how the table writes them β like s8, s16, ui10, ui2, f16 β so don't come for me, I'm copying the table's whole aesthetic π
.
GL_R8β Base Internal FormatGL_RED; Red Bits8GL_R8_SNORMβ Base Internal FormatGL_RED; Red Bitss8GL_R16β Base Internal FormatGL_RED; Red Bits16GL_R16_SNORMβ Base Internal FormatGL_RED; Red Bitss16GL_RG8β Base Internal FormatGL_RG; Red Bits8, Green Bits8GL_RG8_SNORMβ Base Internal FormatGL_RG; Red Bitss8, Green Bitss8GL_RG16β Base Internal FormatGL_RG; Red Bits16, Green Bits16GL_RG16_SNORMβ Base Internal FormatGL_RG; Red Bitss16, Green Bitss16GL_R3_G3_B2β Base Internal FormatGL_RGB; Red Bits3, Green Bits3, Blue Bits2GL_RGB4β Base Internal FormatGL_RGB; Red Bits4, Green Bits4, Blue Bits4GL_RGB5β Base Internal FormatGL_RGB; Red Bits5, Green Bits5, Blue Bits5GL_RGB8β Base Internal FormatGL_RGB; Red Bits8, Green Bits8, Blue Bits8GL_RGB8_SNORMβ Base Internal FormatGL_RGB; Red Bitss8, Green Bitss8, Blue Bitss8GL_RGB10β Base Internal FormatGL_RGB; Red Bits10, Green Bits10, Blue Bits10GL_RGB12β Base Internal FormatGL_RGB; Red Bits12, Green Bits12, Blue Bits12GL_RGB16_SNORMβ Base Internal FormatGL_RGB; Red Bits16, Green Bits16, Blue Bits16GL_RGBA2β Base Internal FormatGL_RGB; Red Bits2, Green Bits2, Blue Bits2, Alpha Bits2GL_RGBA4β Base Internal FormatGL_RGB; Red Bits4, Green Bits4, Blue Bits4, Alpha Bits4GL_RGB5_A1β Base Internal FormatGL_RGBA; Red Bits5, Green Bits5, Blue Bits5, Alpha Bits1GL_RGBA8β Base Internal FormatGL_RGBA; Red Bits8, Green Bits8, Blue Bits8, Alpha Bits8GL_RGBA8_SNORMβ Base Internal FormatGL_RGBA; Red Bitss8, Green Bitss8, Blue Bitss8, Alpha Bitss8GL_RGB10_A2β Base Internal FormatGL_RGBA; Red Bits10, Green Bits10, Blue Bits10, Alpha Bits2GL_RGB10_A2UIβ Base Internal FormatGL_RGBA; Red Bitsui10, Green Bitsui10, Blue Bitsui10, Alpha Bitsui2GL_RGBA12β Base Internal FormatGL_RGBA; Red Bits12, Green Bits12, Blue Bits12, Alpha Bits12GL_RGBA16β Base Internal FormatGL_RGBA; Red Bits16, Green Bits16, Blue Bits16, Alpha Bits16GL_SRGB8β Base Internal FormatGL_RGB; Red Bits8, Green Bits8, Blue Bits8GL_SRGB8_ALPHA8β Base Internal FormatGL_RGBA; Red Bits8, Green Bits8, Blue Bits8, Alpha Bits8GL_R16Fβ Base Internal FormatGL_RED; Red Bitsf16GL_RG16Fβ formatGL_RGΒ· R:f16Β· G:f16πΈGL_RGB16Fβ formatGL_RGBΒ· R:f16Β· G:f16Β· B:f16πGL_RGBA16Fβ formatGL_RGBAΒ· R:f16Β· G:f16Β· B:f16Β· A:f16β¨GL_R32Fβ formatGL_REDΒ· R:f32π¦GL_RG32Fβ formatGL_RGΒ· R:f32Β· G:f32πGL_RGB32Fβ formatGL_RGBΒ· R:f32Β· G:f32Β· B:f32π₯GL_RGBA32Fβ formatGL_RGBAΒ· R:f32Β· G:f32Β· B:f32Β· A:f32πGL_R11F_G11F_B10Fβ formatGL_RGBΒ· R:f11Β· G:f11Β· B:f10πGL_RGB9_E5β formatGL_RGBΒ· R:9Β· G:9Β· B:9Β· shared exponent:5β
okay now we're in the integer era of the table and honestly it's a whole aesthetic π
signed ones get an i, unsigned ones get a ui, and the prefix is literally just how many bits you're working with. no notes, she's consistent.
GL_R8Iβ formatGL_REDΒ· R:i8πGL_R8UIβ formatGL_REDΒ· R:ui8πGL_R16Iβ formatGL_REDΒ· R:i16πGL_R16UIβ formatGL_REDΒ· R:ui16π§GL_R32Iβ formatGL_REDΒ· R:i32π«ΆGL_R32UIβ formatGL_REDΒ· R:ui32π
two channels now, we're levelling up bestie:
GL_RG8Iβ formatGL_RGΒ· R:i8Β· G:i8π¦GL_RG8UIβ formatGL_RGΒ· R:ui8Β· G:ui8πΈGL_RG16Iβ formatGL_RGΒ· R:i16Β· G:i16πGL_RG16UIβ formatGL_RGΒ· R:ui16Β· G:ui16β¨GL_RG32Iβ formatGL_RGΒ· R:i32Β· G:i32π₯GL_RG32UIβ formatGL_RGΒ· R:ui32Β· G:ui32π
three channels, three whole moods:
GL_RGB8Iβ formatGL_RGBΒ· R:i8Β· G:i8Β· B:i8πGL_RGB8UIβ formatGL_RGBΒ· R:ui8Β· G:ui8Β· B:ui8βGL_RGB16Iβ formatGL_RGBΒ· R:i16Β· G:i16Β· B:i16πGL_RGB16UIβ formatGL_RGBΒ· R:ui16Β· G:ui16Β· B:ui16πGL_RGB32Iβ formatGL_RGBΒ· R:i32Β· G:i32Β· B:i32πGL_RGB32UIβ formatGL_RGBΒ· R:ui32Β· G:ui32Β· B:ui32π§
and the full four-channel set, alpha included, we love a complete squad π«Ά
GL_RGBA8Iβ formatGL_RGBAΒ· R:i8Β· G:i8Β· B:i8Β· A:i8πGL_RGBA8UIβ formatGL_RGBAΒ· R:ui8Β· G:ui8Β· B:ui8Β· A:ui8π¦GL_RGBA16Iβ formatGL_RGBAΒ· R:i16Β· G:i16Β· B:i16Β· A:i16πΈGL_RGBA16UIβ formatGL_RGBAΒ· R:ui16Β· G:ui16Β· B:ui16Β· A:ui16π
β¦and the internal-format table (Table 2) is still serving looks, bestie. Last two rows, coming right up:
GL_RGBA32IβGL_RGBAΒ·i32Β·i32Β·i32Β·i32Β· trailing cell emptyGL_RGBA32UIβGL_RGBAΒ·ui32Β·ui32Β·ui32Β·ui32Β· trailing cell empty
Table 3. Compressed Internal Formats
GL_COMPRESSED_REDβ base internal formatGL_REDβ typeGenericGL_COMPRESSED_RGβ base internal formatGL_RGβ typeGenericGL_COMPRESSED_RGBβ base internal formatGL_RGBβ typeGenericGL_COMPRESSED_RGBAβ base internal formatGL_RGBAβ typeGenericGL_COMPRESSED_SRGBβ base internal formatGL_RGBβ typeGenericGL_COMPRESSED_SRGB_ALPHAβ base internal formatGL_RGBAβ typeGenericGL_COMPRESSED_RED_RGTC1β base internal formatGL_REDβ typeSpecificGL_COMPRESSED_SIGNED_RED_RGTC1β base internal formatGL_REDβ typeSpecificGL_COMPRESSED_RG_RGTC2β base internal formatGL_RGβ typeSpecificGL_COMPRESSED_SIGNED_RG_RGTC2β base internal formatGL_RGβ typeSpecificGL_COMPRESSED_RGBA_BPTC_UNORMβ base internal formatGL_RGBAβ typeSpecificGL_COMPRESSED_SRGB_ALPHA_BPTC_UNORMβ base internal formatGL_RGBAβ typeSpecificGL_COMPRESSED_RGB_BPTC_SIGNED_FLOATβ base internal formatGL_RGBβ typeSpecificGL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOATβ base internal formatGL_RGBβ typeSpecific
If the internalformat parameter is one of the generic compressed formats β GL_COMPRESSED_RED, GL_COMPRESSED_RG, GL_COMPRESSED_RGB, or GL_COMPRESSED_RGBA β the GL will replace the internal format with the symbolic constant for a specific internal format and compress the texture before storage. If no corresponding internal format is available, or the GL can not compress that image for any reason, the internal format is instead replaced with a corresponding base internal format. periodt, that's the whole compression glow-up.
If the internalformat parameter is GL_SRGB, GL_SRGB8, GL_SRGB_ALPHA or GL_SRGB8_ALPHA8, the texture is treated as if the red, green, or blue components are encoded in the sRGB color space. Any alpha component is left unchanged. The conversion from the sRGB encoded component c s to a linear component c l is:
c l = { c s / 12.92 if c s β€ 0.04045
{ ( ( c s + 0.055 ) / 1.055 )^2.4 if c s > 0.04045
Assume c s is the sRGB component in the range [0,1]. math queen behavior, honestly. β¨
Use the GL_PROXY_TEXTURE_1D target to try out a resolution and format. The implementation will update and recompute its best match for the requested storage resolution and format. To then query this state, call glGetTexLevelParameter(). If the texture cannot be accommodated, texture state is set to 0. like, it's a vibe check for your texture. π«Ά
A one-component texture image uses only the red component of the RGBA color from data. A two-component image uses the R and A values. A three-component image uses the R, G, and B values. A four-component image uses all of the RGBA components. yes, two-component really is R and A β no cap.
Image-based shadowing can be enabled by comparing texture r coordinates to depth texture values to generate a boolean result. See glTexParameter() for details on texture comparison. π
π NOTES
glPixelStore()modes affect texture images. little settings gremlins, always affecting something.datamay be a null pointer. In this case texture memory is allocated to accommodate a texture of widthwidth. You can then download subtextures to initialize the texture memory. The image is undefined if the program tries to apply an uninitialized portion of the texture image to a primitive. undefined behavior alert β do not romanticize it. πglTexImage1Dspecifies the one-dimensional texture for the current texture unit, specified withglActiveTexture(). current texture unit says hi.GL_STENCIL_INDEXmay be used forformatonly if the GL version is4.4or higher. version check before you even try it, bestie.
π¨ ERRORS
GL_INVALID_ENUMis generated iftargetis notGL_TEXTURE_1DorGL_PROXY_TEXTURE_1D.GL_INVALID_ENUMis generated ifformatis not an accepted format constant. Format constants other thanGL_STENCIL_INDEXare accepted.GL_INVALID_ENUMis generated iftypeis not a type constant.GL_INVALID_VALUEis generated iflevelis less than0.GL_INVALID_VALUEmay be generated iflevelis greater thanlog 2 max, wheremaxis the returned value ofGL_MAX_TEXTURE_SIZE.GL_INVALID_VALUEis generated ifinternalformatis not one of the accepted resolution and format symbolic constants.GL_INVALID_VALUEis generated ifwidthis less than0or greater thanGL_MAX_TEXTURE_SIZE.GL_INVALID_VALUEis generated ifborderis not0.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.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.GL_INVALID_OPERATIONis generated ifformatisGL_DEPTH_COMPONENTandinternalformatis notGL_DEPTH_COMPONENT,GL_DEPTH_COMPONENT16,GL_DEPTH_COMPONENT24, orGL_DEPTH_COMPONENT32.GL_INVALID_OPERATIONis generated ifinternalformatisGL_DEPTH_COMPONENT,GL_DEPTH_COMPONENT16,GL_DEPTH_COMPONENT24, orGL_DEPTH_COMPONENT32, andformatis notGL_DEPTH_COMPONENT.GL_INVALID_OPERATIONis generated if a non-zero buffer object name is bound to theGL_PIXEL_UNPACK_BUFFERtarget and the buffer object's data store is currently mapped.GL_INVALID_OPERATIONis generated if a non-zero buffer object name is bound to theGL_PIXEL_UNPACK_BUFFERtarget and the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.GL_INVALID_OPERATIONis generated if a non-zero buffer object name is bound to theGL_PIXEL_UNPACK_BUFFERtarget anddatais not evenly divisible into the number of bytes needed to store in memory a datum indicated bytype.
error list is long, but she's thorough. read it. memorize it. live it. π
π ASSOCIATED GETS
glGetTexImage()glGet()with argumentGL_PIXEL_UNPACK_BUFFER_BINDING
β¨ VERSION SUPPORT β¨
Okay bestie, vibe check on which OpenGL versions are gonna play nice with these features π (the original lays this out as a big grid, so here it is as a list β same facts, way less squinting):
glTexImage1Dβ slay in every version: 2.0 β, 2.1 β, 3.0 β, 3.1 β, 3.2 β, 3.3 β, 4.0 β, 4.1 β, 4.2 β, 4.3 β, 4.4 β, 4.5 β. Iconic, no notes. πGL_HALF_FLOATβ she's late to the party, and that's fine: 2.0 β (no), 2.1 β (still no), then 3.0 β, 3.1 β, 3.2 β, 3.3 β, 4.0 β, 4.1 β, 4.2 β, 4.3 β, 4.4 β, 4.5 β. So like, from 3.0 onward she's fully main character energy. πΈ
π¦ SEE ALSO π¦
Go touch grass with her friends, fr fr β every one of these is literally right there:
glActiveTexture()glCompressedTexImage1D()glCompressedTexSubImage1D()glCopyTexImage1D()glCopyTexSubImage1D()glGetCompressedTexImage()glPixelStore()glTexImage2D()glTexImage3D()glTexSubImage1D()glTexSubImage2D()glTexSubImage3D()glTexParameter()
π COPYRIGHT π
Copyright Β© 1991-2006 Silicon Graphics, Inc. Copyright Β© 2011-2014 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.
π COPYRIGHT (the sequel) π
Copyright Β© 1991-2006 Silicon Graphics, Inc.
And that's the whole page, bestie β you ate. π«Ά
Sign-off szn: the source shows up as [FIXME: source] (yes, literally a FIXME, we love a humble king π), it's dated 08/09/2021, and the manual page is GLTEXIMAGE1D(3G). Go forth and texture your 1D images. πβ¨
π¦ 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