📄 texture2d.html
字号:
B<sub>f</sub>) and alpha A<sub>f</sub> for each texture unit are the results of texture application in the previous texture unit, or for texture unit 0,the interpolated vertex color. Similarly, the texture values C<sub>t</sub>and A<sub>t</sub> are the results of texture sampling and filtering asspecified above. For luminance textures, the filtered luminance valueL<sub>t</sub> is converted to an RGB color as C<sub>t</sub> = (L<sub>t</sub>,L<sub>t</sub>, L<sub>t</sub>). In the <code>BLEND</code> mode, the textureblend color C<sub>c</sub>, set by <code>setBlendColor</code>, is alsoused.</p><p>The input values are combined to output values C<sub>v</sub> andA<sub>v</sub> depending on the source texture format and the currenttexture blend mode as shown in the table below.</p><table border="true" cellpadding="3" align="center"><tr bgcolor="#C0C0C0" valign="center"><th rowspan="2">Texture format</th><th colspan="5">Blending mode</th></tr><tr align="center" bgcolor="#c0c0c0"><td><code>REPLACE</code></td><td><code>MODULATE</code></td><td><code>DECAL</code></td><td><code>BLEND</code></td><td><code>ADD</code></td></tr><tr><td bgcolor="#C0C0C0"><code>ALPHA</code></td><td> C<sub>v</sub> = C<sub>f</sub><br> A<sub>v</sub> = A<sub>t</sub></td><td> C<sub>v</sub> = C<sub>f</sub><br> A<sub>v</sub> = A<sub>f</sub> A<sub>t</sub></td><td> undefined</td><td> C<sub>v</sub> = C<sub>f</sub><br> A<sub>v</sub> = A<sub>f</sub> A<sub>t</sub></td><td> C<sub>v</sub> = C<sub>f</sub><br> A<sub>v</sub> = A<sub>f</sub> A<sub>t</sub></td></tr><tr><td bgcolor="#C0C0C0"><code>LUMINANCE</code></td><td> C<sub>v</sub> = C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td><td> C<sub>v</sub> = C<sub>f</sub> C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td><td> undefined</td><td> C<sub>v</sub> = C<sub>f</sub> (1 - C<sub>t</sub>) + C<sub>c</sub> C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td><td> C<sub>v</sub> = C<sub>f</sub> + C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td></tr><tr><td bgcolor="#C0C0C0"><code>LUM_ALPHA</code></td><td> C<sub>v</sub> = C<sub>t</sub><br> A<sub>v</sub> = A<sub>t</sub></td><td> C<sub>v</sub> = C<sub>f</sub> C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub> A<sub>t</sub></td><td> undefined</td><td> C<sub>v</sub> = C<sub>f</sub> (1 - C<sub>t</sub>) + C<sub>c</sub> C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub> A<sub>t</sub></td><td> C<sub>v</sub> = C<sub>f</sub> + C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub> A<sub>t</sub></td></tr><tr><td bgcolor="#C0C0C0"><code>RGB</code></td><td> C<sub>v</sub> = C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td><td> C<sub>v</sub> = C<sub>f</sub> C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td><td> C<sub>v</sub> = C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td><td> C<sub>v</sub> = C<sub>f</sub> (1 - C<sub>t</sub>) + C<sub>c</sub> C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td><td> C<sub>v</sub> = C<sub>f</sub> + C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td></tr><tr><td bgcolor="#C0C0C0"><code>RGBA</code></td><td> C<sub>v</sub> = C<sub>t</sub><br> A<sub>v</sub> = A<sub>t</sub></td><td> C<sub>v</sub> = C<sub>f</sub> C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub> A<sub>t</sub></td><td> C<sub>v</sub> = C<sub>f</sub> (1 - A<sub>t</sub>) + C<sub>t</sub> A<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub></td><td> C<sub>v</sub> = C<sub>f</sub> (1 - C<sub>t</sub>) + C<sub>c</sub> C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub> A<sub>t</sub></td><td> C<sub>v</sub> = C<sub>f</sub> + C<sub>t</sub><br> A<sub>v</sub> = A<sub>f</sub> A<sub>t</sub></td></tr></table><h3>Implementation guidelines</h3><p>Texturing is done according to the OpenGL 1.3 specification, section 3.8,with the following exceptions:</p><ul><li>1D, 3D, and cube texture maps are not supported;</li><li>texture borders are not supported (border width is always zero);</li><li>The T texture coordinate and the texture image are both reversed;</li><li>minification and magnification filters cannot be specified separately;</li><li>mipmap level images are generated automatically by the implementation;</li><li>LOD parameters for mipmap level selection are implementation defined;</li><li>The <code>COMBINE</code> texture environment mode is not supported;</li><li>The <code>INTENSITY</code> texture image format is not supported;</li><li>The secondary color is not supported.</li></ul><p>Texture filtering modes, other than point sampling of the base level image,are rendering quality hints that may be ignored by the implementation. However,if they are implemented, the implementation must be according to the OpenGL 1.3specification.</p>
<P>
<P>
<DL>
<DT><B>See Also:</B><DD><a href="../../../file-format.html#Texture2D">Binary format</a></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#FILTER_BASE_LEVEL">FILTER_BASE_LEVEL</A></B></CODE>
<BR>
A level filtering parameter to <code>setFiltering</code> that selects the base level image, even if mipmap levels exist. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#FILTER_LINEAR">FILTER_LINEAR</A></B></CODE>
<BR>
A parameter to <code>setFiltering</code> that selects linear filtering. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#FILTER_NEAREST">FILTER_NEAREST</A></B></CODE>
<BR>
A parameter to <code>setFiltering</code> that selects nearest neighbor filtering. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#FUNC_ADD">FUNC_ADD</A></B></CODE>
<BR>
A parameter to <code>setBlending</code>, specifying that the texel color is to be added to the fragment color. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#FUNC_BLEND">FUNC_BLEND</A></B></CODE>
<BR>
A parameter to <code>setBlending</code>, specifying that the texture blend color is to be blended into the fragment color in proportion to the texel RGB values. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#FUNC_DECAL">FUNC_DECAL</A></B></CODE>
<BR>
A parameter to <code>setBlending</code>, specifying that the texel color is to be blended into the fragment color in proportion to the texel alpha.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#FUNC_MODULATE">FUNC_MODULATE</A></B></CODE>
<BR>
A parameter to <code>setBlending</code>, specifying that the texel color and/or alpha are to be multiplied with the fragment color and alpha.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#FUNC_REPLACE">FUNC_REPLACE</A></B></CODE>
<BR>
A parameter to <code>setBlending</code>, specifying that the texel color and/or alpha are to replace the fragment color and alpha.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#WRAP_CLAMP">WRAP_CLAMP</A></B></CODE>
<BR>
A parameter to <code>setWrapping</code>, specifying that the texture image is to be repeated only once. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/m3g/Texture2D.html#WRAP_REPEAT">WRAP_REPEAT</A></B></CODE>
<BR>
A parameter to <code>setWrapping</code>, specifying that the texture image is to be repeated indefinitely. </TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -