glTexImage1D.3   [plain text]


'\" te  
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp May 22 14:46
.ds Dm 4 May 22 14:
.ds Xs 26416    17
.TH GLTEXIMAGE1D 3G
.SH NAME
.B "glTexImage1D
\- specify a one-dimensional texture image

.SH C SPECIFICATION
void \f3glTexImage1D\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglTexImage1D( 'u
	GLint \fIlevel\fP,
	GLint \fIinternalformat\fP,
	GLsizei \fIwidth\fP,
	GLint \fIborder\fP,
	GLenum \fIformat\fP,
	GLenum \fItype\fP,
	const GLvoid \fI*pixels\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\fIinternalformat\fP\ \ 'u 
\f2target\fP
Specifies the target texture.
Must be \%\f3GL_TEXTURE_1D\fP or \%\f3GL_PROXY_TEXTURE_1D\fP.
.TP
\f2level\fP
Specifies the level-of-detail number.
Level 0 is the base image level.
Level \f2n\fP is the \f2n\fPth mipmap reduction image.
.TP
\f2internalformat\fP
Specifies the number of color components in the texture.
Must be 1, 2, 3, or 4, or one of the following symbolic constants:
\%\f3GL_ALPHA\fP,
\%\f3GL_ALPHA4\fP,
\%\f3GL_ALPHA8\fP,
\%\f3GL_ALPHA12\fP,
\%\f3GL_ALPHA16\fP,
\%\f3GL_LUMINANCE\fP,
\%\f3GL_LUMINANCE4\fP,
\%\f3GL_LUMINANCE8\fP,
\%\f3GL_LUMINANCE12\fP,
\%\f3GL_LUMINANCE16\fP,
\%\f3GL_LUMINANCE_ALPHA\fP,
\%\f3GL_LUMINANCE4_ALPHA4\fP,
\%\f3GL_LUMINANCE6_ALPHA2\fP,
\%\f3GL_LUMINANCE8_ALPHA8\fP,
\%\f3GL_LUMINANCE12_ALPHA4\fP,
\%\f3GL_LUMINANCE12_ALPHA12\fP,
\%\f3GL_LUMINANCE16_ALPHA16\fP,
\%\f3GL_INTENSITY\fP,
\%\f3GL_INTENSITY4\fP,
\%\f3GL_INTENSITY8\fP,
\%\f3GL_INTENSITY12\fP,
\%\f3GL_INTENSITY16\fP,
\%\f3GL_RGB\fP,
\%\f3GL_R3_G3_B2\fP,
\%\f3GL_RGB4\fP,
\%\f3GL_RGB5\fP,
\%\f3GL_RGB8\fP,
\%\f3GL_RGB10\fP,
\%\f3GL_RGB12\fP,
\%\f3GL_RGB16\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_RGBA2\fP,
\%\f3GL_RGBA4\fP,
\%\f3GL_RGB5_A1\fP,
\%\f3GL_RGBA8\fP,
\%\f3GL_RGB10_A2\fP,
\%\f3GL_RGBA12\fP, or
\%\f3GL_RGBA16\fP.
.TP
\f2width\fP
Specifies the width of the texture image.
Must be $2 sup n + 2 ( "border" )$ for some integer $n$. All
implementations support texture images that are at least 64 texels
wide. The height of the 1D texture image is 1.
.TP
\f2border\fP
Specifies the width of the border.
Must be either 0 or 1.
.TP
\f2format\fP
Specifies the  of the pixel data.
The following symbolic values are accepted:
\%\f3GL_COLOR_INDEX\fP,
\%\f3GL_RED\fP,
\%\f3GL_GREEN\fP,
\%\f3GL_BLUE\fP,
\%\f3GL_ALPHA\fP,
\%\f3GL_RGB\fP,
\%\f3GL_BGR\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_BGRA\fP,
\%\f3GL_LUMINANCE\fP, and
\%\f3GL_LUMINANCE_ALPHA\fP.
.TP
\f2type\fP
Specifies the data type of the pixel data.
The following symbolic values are accepted:
\%\f3GL_UNSIGNED_BYTE\fP,
\%\f3GL_BYTE\fP,
\%\f3GL_BITMAP\fP,
\%\f3GL_UNSIGNED_SHORT\fP,
\%\f3GL_SHORT\fP,
\%\f3GL_UNSIGNED_INT\fP,
\%\f3GL_INT\fP,
\%\f3GL_FLOAT\fP,
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP, and
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP.
.TP
\f2pixels\fP
Specifies a pointer to the image data in memory.
.SH 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 \%\f3glEnable\fP
and \%\f3glDisable\fP with argument \%\f3GL_TEXTURE_1D\fP.
.P
Texture images are defined with \%\f3glTexImage1D\fP.
The arguments describe the parameters of the texture image,
such as width,
width of the border,
level-of-detail number
(see \%\f3glTexParameter\fP),
and the internal resolution and  used to store the image.
The last three arguments describe how the image is represented in
memory; they are identical to the pixel formats used for
\%\f3glDrawPixels\fP. 
.P
If \f2target\fP is \%\f3GL_PROXY_TEXTURE_1D\fP, no data is read from \f2pixels\fP, 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 \%\f3glGetError\fP). To query for an
entire mipmap array, use an image array level greater than or equal to
1. 
.P
If \f2target\fP is \%\f3GL_TEXTURE_1D\fP,
data is read from \f2pixels\fP as a sequence of signed or unsigned bytes,
shorts,
or longs,
or single-precision floating-point values,
depending on \f2type\fP. 
These values are grouped into sets of one,
two,
three,
or four values,
depending on \f2format\fP,
to form elements. 
If \f2type\fP is \%\f3GL_BITMAP\fP,
the data is considered as a string of unsigned bytes
(and \f2format\fP must be \%\f3GL_COLOR_INDEX\fP). 
Each data byte is treated as eight 1-bit elements,
with bit ordering determined by \%\f3GL_UNPACK_LSB_FIRST\fP
(see \%\f3glPixelStore\fP).
.P
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.
.P
\f2format\fP determines the composition of each element in \f2pixels\fP.
It can assume one of eleven symbolic values:
.TP 10
\%\f3GL_COLOR_INDEX\fP
Each element is a single value,
a color index. 
The GL converts it 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 \%\f3GL_INDEX_SHIFT\fP,
and added to \%\f3GL_INDEX_OFFSET\fP
(see \%\f3glPixelTransfer\fP). 
The resulting index is converted to a set of color components
using the
\%\f3GL_PIXEL_MAP_I_TO_R\fP,
\%\f3GL_PIXEL_MAP_I_TO_G\fP,
\%\f3GL_PIXEL_MAP_I_TO_B\fP, and
\%\f3GL_PIXEL_MAP_I_TO_A\fP tables,
and clamped to the range [0,1].
.TP
\%\f3GL_RED\fP
Each element is a single red component. 
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for green and blue, and 1 for alpha. 
Each component is then multiplied by the signed scale factor \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP.  
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_GREEN\fP
Each element is a single green component. 
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for red and blue, and 1 for alpha. 
Each component is then multiplied by the signed scale factor \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_BLUE\fP
Each element is a single blue component. 
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for red and green, and 1 for alpha. 
Each component is then multiplied by the signed scale factor \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_ALPHA\fP
Each element is a single alpha component. 
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for red, green, and blue.
Each component is then multiplied by the signed scale factor \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_RGB\fP
.TP
\%\f3GL_BGR\fP
Each element is an RGB triple.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 1 for alpha.
Each component is then multiplied by the signed scale factor \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_RGBA\fP
.TP
\%\f3GL_BGRA\fP
Each element contains all four components.
Each component is then multiplied by the signed scale factor \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_LUMINANCE\fP
Each element is a single luminance value.
The GL converts it to floating point,
then assembles it into an RGBA element by replicating the luminance value
three times for red, green, and blue and attaching 1 for alpha. 
Each component is then multiplied by the signed scale factor \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1]
(see \%\f3glPixelTransfer\fP).
.TP
\%\f3GL_LUMINANCE_ALPHA\fP
Each element is a luminance/alpha pair.
The GL converts it to floating point,
then assembles it 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 \%\f3GL_c_SCALE\fP,
added to the signed bias \%\f3GL_c_BIAS\fP,
and clamped to the range [0,1] (see \%\f3glPixelTransfer\fP).
.P
If an application wants to store the texture at a certain
resolution or in a certain , it can request the resolution
and  with \f2internalformat\fP. The GL will choose an internal
representation that closely approximates that requested by \f2internalformat\fP, but
it may not match exactly.
(The representations specified by \%\f3GL_LUMINANCE\fP, \%\f3GL_LUMINANCE_ALPHA\fP, \%\f3GL_RGB\fP,
and \%\f3GL_RGBA\fP must match exactly. The numeric values 1, 2, 3, and 4 may also be used to 
specify the preceding representations.)
.P
Use the \%\f3GL_PROXY_TEXTURE_1D\fP target to try out a resolution and
. The implementation will
update and recompute its best match for the requested storage resolution
and . To query this state, call \%\f3glGetTexLevelParameter\fP.
If the texture cannot be accommodated, texture state is set to 0.
.P
A one-component texture image uses only the red component of the RGBA
color from \f2pixels\fP. 
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. 
.SH NOTES
Texturing has no effect in color index mode.
.P
If the \%\f3GL_ARB_imaging\fP extension is supported, RGBA elements may
also be processed by the imaging pipeline.  The following stages may be
applied to an RGBA color before color component clamping to the range
[0,\ 1]:
.TP 3
1. Color component replacement by the color table specified for
\%\f3GL_COLOR_TABLE\fP, if enabled. See \%\f3glColorTable\fP.
.TP
2. One-dimensional convolution filtering, if enabled. See
\%\f3glConvolutionFilter1D\fP.
.IP
If a convolution filter changes the __width of the texture (by
processing with a \%\f3GL_CONVOLUTION_BORDER_MODE\fP of \%\f3GL_REDUCE\fP, for 
example), the \f2width\fP must $2 sup n + 2 ( "border" )$, for some
integer $n$, after filtering.
.TP
3. RGBA components may be multiplied by \%\f3GL_POST_CONVOLUTION_c_SCALE\fP, 
and added to \%\f3GL_POST_CONVOLUTION_c_BIAS\fP, if enabled.  See 
\%\f3glPixelTransfer\fP.
.TP
4. Color component replacement by the color table specified for
\%\f3GL_POST_CONVOLUTION_COLOR_TABLE\fP, if enabled.  See \%\f3glColorTable\fP.
.TP
5. Transformation by the color matrix.  See \%\f3glMatrixMode\fP.
.TP
6. RGBA components may be multiplied by \%\f3GL_POST_COLOR_MATRIX_c_SCALE\fP, 
and added to \%\f3GL_POST_COLOR_MATRIX_c_BIAS\fP, if enabled.  See 
\%\f3glPixelTransfer\fP.
.TP
7. Color component replacement by the color table specified for
\%\f3GL_POST_COLOR_MATRIX_COLOR_TABLE\fP, if enabled.  See \%\f3glColorTable\fP.
.P
The texture image can be represented by the same data formats
as the pixels in a \%\f3glDrawPixels\fP command,
except that \%\f3GL_STENCIL_INDEX\fP and \%\f3GL_DEPTH_COMPONENT\fP
cannot be used.
\%\f3glPixelStore\fP and \%\f3glPixelTransfer\fP modes affect texture images
in exactly the way they affect \%\f3glDrawPixels\fP.
.P
\%\f3GL_PROXY_TEXTURE_1D\fP may be used only if the GL version is 1.1 or greater.
.P
Internal formats other than 1, 2, 3, or 4 may be 
used only if the GL version is 1.1 or greater.
.P
In GL version 1.1 or greater, 
\f2pixels\fP may be a null pointer. In this case texture memory is
allocated to accommodate a texture of width \f2width\fP. 
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.
.P
Formats \%\f3GL_BGR\fP, and \%\f3GL_BGRA\fP and types
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP, and
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP are available only if the GL version 
is 1.2 or greater.
.P
When the \%\f3GL_ARB_multitexture\fP extension is supported, \%\f3glTexImage1D\fP
specifies the one-dimensional texture for the current texture unit,
specified with \%\f3glActiveTextureARB\fP.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2target\fP is not \%\f3GL_TEXTURE_1D\fP
or \%\f3GL_PROXY_TEXTURE_1D\fP.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2format\fP is not an accepted
 constant.
Format constants other than \%\f3GL_STENCIL_INDEX\fP and \%\f3GL_DEPTH_COMPONENT\fP
are accepted.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2type\fP is not a type constant.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2type\fP is \%\f3GL_BITMAP\fP and
\f2format\fP is not \%\f3GL_COLOR_INDEX\fP.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2level\fP is less than 0.
.P 
\%\f3GL_INVALID_VALUE\fP may be generated if \f2level\fP is greater than $log
sub 2$\f2max\fP,
where \f2max\fP is the returned value of \%\f3GL_MAX_TEXTURE_SIZE\fP.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2internalformat\fP is not 1, 2, 3, 4, or
one of the accepted resolution and  symbolic constants.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2width\fP is less than 0
or greater than 2 + \%\f3GL_MAX_TEXTURE_SIZE\fP,
or if it cannot be represented as $2 sup n ~+~ 2("border")$ 
for some integer value of \f2n\fP.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2border\fP is not 0 or 1.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glTexImage1D\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \f2type\fP is one of
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP, or
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP
and \f2format\fP is not \%\f3GL_RGB\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \f2type\fP is one of
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP, or
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP
and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
.SH ASSOCIATED GETS
\%\f3glGetTexImage\fP
.br
\%\f3glIsEnabled\fP with argument \%\f3GL_TEXTURE_1D\fP
.SH SEE ALSO
\%\f3glActiveTextureARB\fP,
\%\f3glColorTable\fP,
\%\f3glConvolutionFilter1D\fP,
\%\f3glCopyPixels\fP,
\%\f3glCopyTexImage1D\fP,
\%\f3glCopyTexImage2D\fP,
\%\f3glCopyTexSubImage1D\fP,
\%\f3glCopyTexSubImage2D\fP,
\%\f3glCopyTexSubImage3D\fP,
\%\f3glDrawPixels\fP,
\%\f3glMatrixMode\fP,
\%\f3glPixelStore\fP,
\%\f3glPixelTransfer\fP,
\%\f3glTexEnv\fP,
\%\f3glTexGen\fP,
\%\f3glTexImage2D\fP,
\%\f3glTexImage3D\fP,
\%\f3glTexSubImage1D\fP,
\%\f3glTexSubImage2D\fP,
\%\f3glTexSubImage3D\fP,
\%\f3glTexParameter\fP