📄 teximage2d.html
字号:
<STRONG>GL_RGB</STRONG> 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
<STRONG>GL_c_SCALE</STRONG>, added to the signed bias <STRONG>GL_c_BIAS</STRONG>,
and clamped to the range [0,1] (see
<STRONG>glPixelTransfer</STRONG>).
<STRONG>GL_RGBA</STRONG> Each element contains all four components. Each
component is multiplied by the signed scale factor
<STRONG>GL_c_SCALE</STRONG>, added to the signed bias <STRONG>GL_c_BIAS</STRONG>,
and clamped to the range [0,1] (see
<STRONG>glPixelTransfer</STRONG>).
<STRONG>GL_LUMINANCE</STRONG>
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 <STRONG>GL_c_SCALE</STRONG>,
added to the signed bias <STRONG>GL_c_BIAS</STRONG>, and clamped to
the range [0,1] (see <STRONG>glPixelTransfer</STRONG>).
<STRONG>GL_LUMINANCE_ALPHA</STRONG>
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 <STRONG>GL_c_SCALE</STRONG>, added to the signed bias
<STRONG>GL_c_BIAS</STRONG>, and clamped to the range [0,1] (see
<STRONG>glPixelTransfer</STRONG>).
Refer to the <STRONG>glDrawPixels</STRONG> reference page for a description
of the acceptable values for the <EM>type</EM> parameter.
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 <EM>internalformat</EM>. The GL will
choose an internal representation that closely approximates
that requested by <EM>internalformat</EM>, but it may not match
exactly. (The representations specified by <STRONG>GL_LUMINANCE</STRONG>,
<STRONG>GL_LUMINANCE_ALPHA</STRONG>, <STRONG>GL_RGB</STRONG>, and <STRONG>GL_RGBA</STRONG> must match exactly.
The numeric values 1, 2, 3, and 4 may also be used to
specify the above representations.)
Use the <STRONG>GL_PROXY_TEXTURE_2D</STRONG> 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 <STRONG>glGetTexLevelParameter</STRONG>. If
the texture cannot be accommodated, texture state is set to
0.
A one-component texture image uses only the red component of
the RGBA color extracted from <EM>pixels</EM>. 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.
<STRONG>NOTES</STRONG>
Texturing has no effect in color index mode.
The texture image can be represented by the same data
formats as the pixels in a <STRONG>glDrawPixels</STRONG> command, except that
<STRONG>GL_STENCIL_INDEX</STRONG> and <STRONG>GL_DEPTH_COMPONENT</STRONG> cannot be used.
<STRONG>glPixelStore</STRONG> and <STRONG>glPixelTransfer</STRONG> modes affect texture images
in exactly the way they affect <STRONG>glDrawPixels</STRONG>.
<STRONG>glTexImage2D</STRONG> and <STRONG>GL_PROXY_TEXTURE_2D</STRONG> are only available 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, <EM>pixels</EM> may be a null pointer.
In this case texture memory is allocated to accommodate a
texture of width <EM>width</EM> and height <EM>height</EM>. You can then
download subtextures to initialize this texture memory. The
image is undefined if the user tries to apply an
uninitialized portion of the texture image to a primitive.
<STRONG>ERRORS</STRONG>
<STRONG>GL_INVALID_ENUM</STRONG> is generated if <EM>target</EM> is not <STRONG>GL_TEXTURE_2D</STRONG>
or <STRONG>GL_PROXY_TEXTURE_2D</STRONG>.
<STRONG>GL_INVALID_ENUM</STRONG> is generated if <EM>format</EM> is not an accepted
format constant. Format constants other than
<STRONG>GL_STENCIL_INDEX</STRONG> and <STRONG>GL_DEPTH_COMPONENT</STRONG> are accepted.
<STRONG>GL_INVALID_ENUM</STRONG> is generated if <EM>type</EM> is not a type constant.
<STRONG>GL_INVALID_ENUM</STRONG> is generated if <EM>type</EM> is <STRONG>GL_BITMAP</STRONG> and <EM>format</EM>
is not <STRONG>GL_COLOR_INDEX</STRONG>.
<STRONG>GL_INVALID_VALUE</STRONG> is generated if <EM>level</EM> is less than 0.
<STRONG>GL_INVALID_VALUE</STRONG> may be generated if <EM>level</EM> is greater than
log <EM>max</EM>, where <EM>max</EM> is the returned value of
<STRONG>GL_MAX_TEXTURE_SIZE</STRONG>.
<STRONG>GL_INVALID_VALUE</STRONG> is generated if <EM>internalformat</EM> is not 1, 2,
3, 4, or one of the accepted resolution and format symbolic
constants.
<STRONG>GL_INVALID_VALUE</STRONG> is generated if <EM>width</EM> or <EM>height</EM> is less
than 0 or greater than 2 + <STRONG>GL_MAX_TEXTURE_SIZE</STRONG>, or if either
cannot be represented as 2k+2(border) for some integer value
of <EM>k</EM>.
<STRONG>GL_INVALID_VALUE</STRONG> is generated if <EM>border</EM> is not 0 or 1.
<STRONG>GL_INVALID_OPERATION</STRONG> is generated if <STRONG>glTexImage2D</STRONG> is
executed between the execution of <STRONG>glBegin</STRONG> and the
corresponding execution of <STRONG>glEnd</STRONG>.
<STRONG>ASSOCIATED</STRONG> <STRONG>GETS</STRONG>
<STRONG>glGetTexImage</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_TEXTURE_2D</STRONG>
<STRONG>SEE</STRONG> <STRONG>ALSO</STRONG>
<STRONG>glCopyPixels</STRONG>, <STRONG>glCopyTexImage1D</STRONG>, <STRONG>glCopyTexImage2D</STRONG>,
<STRONG>glCopyTexSubImage1D</STRONG>, <STRONG>glCopyTexSubImage2D</STRONG>, <STRONG>glDrawPixels</STRONG>,
<STRONG>glPixelStore</STRONG>, <STRONG>glPixelTransfer</STRONG>, <STRONG>glTexEnv</STRONG>, <STRONG>glTexGen</STRONG>,
<STRONG>glTexImage1D</STRONG>, <STRONG>glTexSubImage1D</STRONG>, <STRONG>glTexSubImage2D</STRONG>,
<STRONG>glTexParameter</STRONG>
</PRE>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -