glTexImage1D(3G) OpenGL Reference glTexImage1D(3G)
NAME
glTexImage1D - specify a one-dimensional texture image
C SPECIFICATION
void glTexImage1D( GLenum target,
GLint level,
GLint components,
GLsizei width,
GLint border,
GLenum format,
GLenum type,
const GLvoid *pixels )
PARAMETERS
target Specifies the target texture. Must be GLTEXTURE1D,
GLPROXYTEXTURE1D or GLPROXYTEXTURE1DEXT.
level Specifies the level-of-detail number. Level 0 is the base
image level. Level n is the nth mipmap reduction image.
components is used to request the internal storage format of the texture
image. It must be 1, 2, 3, or 4, or one of the following
symbolic constants: GLALPHA, GLALPHA4, GLALPHA4EXT,
GLALPHA8, GLALPHA8EXT, GLALPHA12, GLALPHA12EXT,
GLALPHA16, GLALPHA16EXT, GLLUMINANCE, GLLUMINANCE4,
GLLUMINANCE4EXT, GLLUMINANCE8, GLLUMINANCE8EXT,
GLLUMINANCE12, GLLUMINANCE12EXT, GLLUMINANCE16,
GLLUMINANCE16EXT, GLLUMINANCEALPHA, GLLUMINANCE4ALPHA4,
GLLUMINANCE4ALPHA4EXT, GLLUMINANCE6ALPHA2,
GLLUMINANCE6ALPHA2EXT, GLLUMINANCE8ALPHA8,
GLLUMINANCE8ALPHA8EXT, GLLUMINANCE12ALPHA4,
GLLUMINANCE12ALPHA4EXT, GLLUMINANCE12ALPHA12,
GLLUMINANCE12ALPHA12EXT, GLLUMINANCE16ALPHA16,
GLLUMINANCE16ALPHA16EXT, GLINTENSITY, GLINTENSITYEXT,
GLINTENSITY4, GLINTENSITY4EXT, GLINTENSITY8,
GLINTENSITY8EXT, GLINTENSITY12, GLINTENSITY12EXT,
GLINTENSITY16, GLINTENSITY16EXT, GLRGB, GLR3G3B2,
GLRGB2EXT, GLRGB4, GLRGB4EXT, GLRGB5, GLRGB5EXT,
GLRGB8, GLRGB8EXT, GLRGB10, GLRGB10EXT, GLRGB12,
GLRGB12EXT, GLRGB16, GLRGB16EXT, GLRGBA, GLRGBA2,
GLRGBA2EXT, GLRGBA4, GLRGBA4EXT, GLRGB5A1,
GLRGB5A1EXT, GLRGBA8, GLRGBA8EXT, GLRGB10A2,
GLRGB10A2EXT, GLRGBA12, GLRGBA12EXT, GLRGBA16,
GLRGBA16EXT, GLDUALALPHA4SGIS, GLDUALALPHA8SGIS,
GLDUALALPHA12SGIS, GLDUALALPHA16SGIS,
GLDUALLUMINANCE4SGIS, GLDUALLUMINANCE8SGIS,
GLDUALLUMINANCE12SGIS, GLDUALLUMINANCE16SGIS,
GLDUALINTENSITY4SGIS, GLDUALINTENSITY8SGIS,
GLDUALINTENSITY12SGIS, GLDUALINTENSITY16SGIS,
GLDUALLUMINANCEALPHA4SGIS, GLDUALLUMINANCEALPHA8SGIS,
Page 1
glTexImage1D(3G) OpenGL Reference glTexImage1D(3G)
GLQUADALPHA4SGIS, GLQUADALPHA8SGIS,
GLQUADLUMINANCE4SGIS, GLQUADLUMINANCE8SGIS,
GLQUADINTENSITY4SGIS, or GLQUADINTENSITY8SGIS.
width Specifies the width of the texture image. Must be
2**n+2*border for some integer n. All implementation support
texture images that are at least 64 texels wide. The height
of the texture image is 1.
border Specifies the width of the border. Must be either 0 or 1.
format Specifies the format of the pixel data. The following
symbolic values are accepted: GLCOLORINDEX, GLRED,
GLGREEN, GLBLUE, GLALPHA, GLRGB, GLRGBA, GLABGREXT,
GLLUMINANCE, and GLLUMINANCEALPHA.
type Specifies the data type of the pixel data. The following
symbolic values are accepted: GLUNSIGNEDBYTE, GLBYTE,
GLBITMAP, GLUNSIGNEDSHORT, GLSHORT, GLUNSIGNEDINT,
GLINT, GLFLOAT, GLUNSIGNEDBYTE332EXT,
GLUNSIGNEDSHORT4444EXT, GLUNSIGNEDSHORT5551EXT,
GLUNSIGNEDINT8888EXT, and
GLUNSIGNEDINT1010102EXT.
pixels 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, use glEnable and glDisable with argument
GLTEXTURE1D.
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, and they are identical to the
pixel formats used for glDrawPixels.
If target is GLPROXYTEXTURE1D or GLPROXYTEXTURE1DEXT no data is
read from pixels, 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 will set all of the texture image state to 0
(GLTEXTUREWIDTH, GLTEXTUREHEIGHT, GLTEXTUREBORDER,
GLTEXTUREINTERNALFORMAT, GLTEXTURECOMPONENTS, GLTEXTUREREDSIZE,
GLTEXTUREREDSIZEEXT, GLTEXTUREGREENSIZE,
GLTEXTUREGREENSIZEEXT, GLTEXTUREBLUESIZE,
GLTEXTUREBLUESIZEEXT, GLTEXTUREALPHASIZE,
GLTEXTUREALPHASIZEEXT, GLTEXTURELUMINANCESIZE,
GLTEXTURELUMINANCESIZEEXT, GLTEXTUREINTENSITYSIZE), and
GLTEXTUREINTENSITYSIZEEXT), but no error will be generated.
Page 2
glTexImage1D(3G) OpenGL Reference glTexImage1D(3G)
If target is GLTEXTURE1D, data is read from pixels 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. (Note that if type is set to GLUNSIGNEDBYTE332EXT,
GLUNSIGNEDSHORT4444EXT, GLUNSIGNEDSHORT5551EXT,
GLUNSIGNEDINT8888EXT, or GLUNSIGNEDINT1010102EXT then it is
a special case in which all the elements of each group are packed into a
single unsigned byte, unsigned short, or unsigned int. This is described
in glDrawPixels.)
If type is GLBITMAP, the data is considered as a string of unsigned
bytes (and format must be GLCOLORINDEX). Each data byte is treated as
eight 1-bit elements, with bit ordering determined by GLUNPACKLSBFIRST
(see glPixelStore).
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 pixels. It can
assume one of nine symbolic values:
GLCOLORINDEX
Each element is a single value, a color index. It is converted
to fixed point (with an unspecified number of zero bits to the
right of the binary point), shifted left or right depending on
the value and sign of GLINDEXSHIFT, and added to
GLINDEXOFFSET (see glPixelTransfer). The resulting index is
converted to a set of color components using the
GLPIXELMAPITOR, GLPIXELMAPITOG, GLPIXELMAPITOB,
and GLPIXELMAPITOA tables, and clamped to the range [0,1].
GLRED Each element is a single red component. It is converted to
floating point and assembled into an RGBA element by attaching
0.0 for green and blue, and 1.0 for alpha. Each component is
then multiplied by the signed scale factor GLcSCALE, added to
the signed bias GLcBIAS, and clamped to the range [0,1] (see
glPixelTransfer).
GLGREEN Each element is a single green component. It is converted to
floating point and assembled into an RGBA element by attaching
0.0 for red and blue, and 1.0 for alpha. Each component is then
multiplied by the signed scale factor GLcSCALE, added to the
signed bias GLcBIAS, and clamped to the range [0,1] (see
glPixelTransfer).
GLBLUE Each element is a single blue component. It is converted to
floating point and assembled into an RGBA element by attaching
0.0 for red and green, and 1.0 for alpha. Each component is
then multiplied by the signed scale factor GLcSCALE, added to
Page 3
glTexImage1D(3G) OpenGL Reference glTexImage1D(3G)
the signed bias GLcBIAS, and clamped to the range [0,1] (see
glPixelTransfer).
GLALPHA Each element is a single alpha component. It is converted to
floating point and assembled into an RGBA element by attaching
0.0 for red, green, and blue. Each component is then
multiplied by the signed scale factor GLcSCALE, added to the
signed bias GLcBIAS, and clamped to the range [0,1] (see
glPixelTransfer).
GLRGB Each element is an RGB triple. It is converted to floating
point and assembled into an RGBA element by attaching 1.0 for
alpha. Each component is then multiplied by the signed scale
factor GLcSCALE, added to the signed bias GLcBIAS, and
clamped to the range [0,1] (see glPixelTransfer).
GLRGBA,
GLABGREXT
Each element contains all four components. Each component is
multiplied by the signed scale factor GLcSCALE, added to the
signed bias GLcBIAS, and clamped to the range [0,1].
GLABGREXT may be faster or slower than GLRGBA depending on
the internal ordering native to the GL. (see glPixelTransfer).
GLLUMINANCE
Each element is a single luminance value. It is converted to
floating point, then assembled into an RGBA element by
replicating the luminance value three times for red, green, and
blue and attaching 1.0 for alpha. Each component is then
multiplied by the signed scale factor GLcSCALE, added to the
signed bias GLcBIAS, and clamped to the range [0,1] (see
glPixelTransfer).
GLLUMINANCEALPHA
Each element is a luminance/alpha pair. It is converted to
floating point, then assembled into an RGBA element by
replicating the luminance value three times for red, green, and
blue. Each component is then multiplied by the signed scale
factor GLcSCALE, added to the signed bias GLcBIAS, and
clamped to the range [0,1] (see glPixelTransfer).
An application may desire that the texture be stored at a certain
resolution, or that it be stored in a certain format. This resolution and
format can be requested by components. The GL will choose an internal
representation that closely approximates that requested by components,
but it may not match exactly. (The representations specified by
GLLUMINANCE, GLLUMINANCEALPHA, GLRGB, and GLRGBA must match exactly.
The numeric values 1, 2, 3, and 4 may also be used to specify the above
representations.) The GLPROXYTEXTURE1D and GLPROXYTEXTURE1DEXT
targets can be used to try-out a resolution and format, the
implementation will update and recompute it's best match for the
Page 4
glTexImage1D(3G) OpenGL Reference glTexImage1D(3G)
requested storage resolution and format. This state can then be queried
using glGetTexLevelParameter. If the texture cannot be accomodated
texture state will be set to 0.
A one-component texture image uses only the red component of the RGBA
color extracted from pixels. 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.
The mapping of components from the canonical RGBA to the internal storage
formats that begin with GLDUAL and GLQUAD needs to be clarified.
There are three cases. The first case is for the GLDUAL formats that
are groups of GLALPHA, GLLUMINANCE, and GLINTENSITY. The R value goes
to the first group while the A value goes to the second group. The
second case is for the GLDUAL formats that are groups of
GLLUMINANCEALPHA. The R and G values go to the first group while the B
and A values go to the second group. The third case is for the GLQUAD
formats. The R value goes to the first group, the G value to the second
group, the B value to the third group, and the A value to the fourth
group.
NOTES
Texturing has no effect in color index mode.
The texture image can be represented by the same data formats as the
pixels in a glDrawPixels command, except that GLSTENCILINDEX and
GLDEPTHCOMPONENT cannot be used. glPixelStore and glPixelTransfer
modes affect texture images in exactly the way they affect glDrawPixels.
GLPROXYTEXTURE1D may only be used if the GL version is 1.1 or greater.
Internal formats other than 1, 2, 3, or 4 may only be used if the GL
version is 1.1 or greater.
In GL version 1.1 or greater, pixels may be a null pointer. In this case
texture memory is allocated to accommodate a texture of width width. 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.
If the extensions string contains GLEXTabgr, then EXTabgr is
supported.
If type is set to GLUNSIGNEDBYTE332EXT,
GLUNSIGNEDSHORT4444EXT, GLUNSIGNEDSHORT5551EXT,
GLUNSIGNEDINT8888EXT, or GLUNSIGNEDINT1010102EXT and the
EXTpackedpixels extension is not supported then a GLINVALIDENUM error
is generated.
See glIntro for more information on using extensions.
Page 5
glTexImage1D(3G) OpenGL Reference glTexImage1D(3G)
ERRORS
GLINVALIDENUM is generated when target is not GLTEXTURE1D.
GLINVALIDENUM is generated when format is not an accepted format
constant. Format constants other than GLSTENCILINDEX and
GLDEPTHCOMPONENT are accepted.
GLINVALIDENUM is generated when type is not a type constant.
GLINVALIDENUM is generated if type is GLBITMAP and format is not
GLCOLORINDEX.
GLINVALIDVALUE is generated if level is less than zero.
GLINVALIDVALUE is generated if components is not 1, 2, 3, or 4 or one
of the accepted resolution and format symbolic constants.
GLINVALIDVALUE is generated if width is less than zero or greater than
2 + GLMAXTEXTURESIZE, or if it cannot be represented as 2**n+2*border
for some integer value of n.
GLINVALIDVALUE is generated if border is not 0 or 1.
GLINVALIDOPERATION is generated if glTexImage1D is executed between the
execution of glBegin and the corresponding execution of glEnd.
GLINVALIDVALUE is generated if the implementation cannot accomodate a
texture of the size requested.
ASSOCIATED GETS
glGetTexImage
glIsEnabled with argument GLTEXTURE1D
glGetTexLevelParameter with a first argument of GLPROXYTEXTURE1D or
GLPROXYTEXTURE1DEXT and a third argument of GLTEXTUREREDSIZE,
GLTEXTUREREDSIZEEXT, GLTEXTUREGREENSIZE,
GLTEXTUREGREENSIZEEXT, GLTEXTUREBLUESIZE,
GLTEXTUREBLUESIZEEXT, GLTEXTUREALPHASIZE,
GLTEXTUREALPHASIZEEXT, GLTEXTURELUMINANCESIZE,
GLTEXTURELUMINANCESIZEEXT, GLTEXTUREINTENSITYSIZE,
GLTEXTUREINTENSITYSIZEEXT, GLTEXTUREWIDTH, GLTEXTUREHEIGHT,
GLTEXTUREBORDER, GLTEXTUREINTERNALFORMAT, or GLTEXTURECOMPONENTS.
MACHINE DEPENDENCIES
RealityEngine, RealityEngine2, and VTX systems do not support color
matrix transformations on images as they are loaded to or read back from
texture memory.
RealityEngine, RealityEngine2, and VTX systems do not support convolving
images as they are loaded into texture memory.
Page 6
glTexImage1D(3G) OpenGL Reference glTexImage1D(3G)
RealityEngine, RealityEngine2, and VTX systems do not support histogram
or minmax operations on images as they are being loaded into texture
memory.
The EXTpackedpixels extension is not supported on RealityEngine,
RealityEngine2, and VTX systems.
On RealityEngine, RealityEngine2, and VTX systems:
1. The texture environment must be defined and texturing must be
enabled before loading a texture.
2. Texture formats composed only of alpha are not supported.
3. Borders are not supported; hence the border width must be 0.
4. Proxy textures are not supported.
5. glTexImage2D with a NULL texture image may not be used inside a
display list.
6. GLINTERLACESGIX is not supported (see glEnable).
On High Impact and Maximum Impact systems the number of bits per
component, represented internally, is the same for all components and
will be 4, 8, or 12 bits per component. All specified internal formats
will receive an equal or greater representation in this scheme, up to the
12-bit limit. High Impact and Maximum Impact on Indigo2 systems do not
support texture internal formats of the type GLINTENSITY or GLALPHA,
although High Impact and Maximum Impact on Octane systems do support
these types.
High Impact and Maximum Impact on Indigo2 systems without the TRAM option
card support 4 bits per component for GLRGB and GLRGBA, 4/8 bits per
component for GLLUMINANCEALPHA, and 4/8/12 bits per component for
GLLUMINANCE.
Texture borders are not supported on InfiniteReality systems, so the
border width should always be zero. Applications should use the texture
wrap mode GLCLAMPTOEDGESGIS to obtain behavior similar to that of
borders.
The SGIStextureselect extension is supported only on InfiniteReality
systems, High Impact and Maximum Impact on Octane systems, and High
Impact and Maximum Impact on Indigo2 systems with the TRAM option card.
On InfiniteReality, RealityEngine, RealityEngine2, and VTX systems, and
High Impact and Maximum Impact systems, texture objects (see
glBindTextureEXT) are significantly faster than display-listed textures,
and therefore are recommended for managing texture memory.
Page 7
glTexImage1D(3G) OpenGL Reference glTexImage1D(3G)
SEE ALSOcmnd(CopyPixels),
glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D,
glCopyTexSubImage2D, glDrawPixels, glPixelStore, glPixelTransfer,
glTexEnv, glTexGen, glTexImage2D, glTexSubImage1D, glTexSubImage2D,
glTexParameter
Page 8