| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
| 3 | <!-- saved from url=(0013)about:internet --> |
| 4 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glTexParameter - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glTexParameter"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glTexParameter — set texture parameters</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexParameterf</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">param</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexParameteri</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">param</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>target</code></em></span></dt><dd><p> |
| 5 | Specifies the target texture, |
| 6 | which must be either <code class="constant">GL_TEXTURE_1D</code>, <code class="constant">GL_TEXTURE_2D</code>, |
| 7 | <code class="constant">GL_TEXTURE_3D</code>, <code class="constant">GL_TEXTURE_1D_ARRAY</code>, |
| 8 | <code class="constant">GL_TEXTURE_2D_ARRAY</code>, <code class="constant">GL_TEXTURE_RECTANGLE</code>, |
| 9 | or <code class="constant">GL_TEXTURE_CUBE_MAP</code>. |
| 10 | </p></dd><dt><span class="term"><em class="parameter"><code>pname</code></em></span></dt><dd><p> |
| 11 | Specifies the symbolic name of a single-valued texture parameter. |
| 12 | <em class="parameter"><code>pname</code></em> can be one of the following: |
| 13 | <code class="constant">GL_DEPTH_STENCIL_TEXTURE_MODE</code>, |
| 14 | <code class="constant">GL_TEXTURE_BASE_LEVEL</code>, |
| 15 | <code class="constant">GL_TEXTURE_COMPARE_FUNC</code>, |
| 16 | <code class="constant">GL_TEXTURE_COMPARE_MODE</code>, |
| 17 | <code class="constant">GL_TEXTURE_LOD_BIAS</code>, |
| 18 | <code class="constant">GL_TEXTURE_MIN_FILTER</code>, |
| 19 | <code class="constant">GL_TEXTURE_MAG_FILTER</code>, |
| 20 | <code class="constant">GL_TEXTURE_MIN_LOD</code>, |
| 21 | <code class="constant">GL_TEXTURE_MAX_LOD</code>, |
| 22 | <code class="constant">GL_TEXTURE_MAX_LEVEL</code>, |
| 23 | <code class="constant">GL_TEXTURE_SWIZZLE_R</code>, |
| 24 | <code class="constant">GL_TEXTURE_SWIZZLE_G</code>, |
| 25 | <code class="constant">GL_TEXTURE_SWIZZLE_B</code>, |
| 26 | <code class="constant">GL_TEXTURE_SWIZZLE_A</code>, |
| 27 | <code class="constant">GL_TEXTURE_WRAP_S</code>, |
| 28 | <code class="constant">GL_TEXTURE_WRAP_T</code>, or |
| 29 | <code class="constant">GL_TEXTURE_WRAP_R</code>. |
| 30 | </p></dd><dt><span class="term"><em class="parameter"><code>param</code></em></span></dt><dd><p> |
| 31 | Specifies the value of <em class="parameter"><code>pname</code></em>. |
| 32 | </p></dd></dl></div></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexParameterfv</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexParameteriv</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLint * </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexParameterIiv</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLint * </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexParameterIuiv</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLuint * </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters2"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>target</code></em></span></dt><dd><p> |
| 33 | Specifies the target texture, |
| 34 | which must be either <code class="constant">GL_TEXTURE_1D</code>, <code class="constant">GL_TEXTURE_2D</code>, |
| 35 | <code class="constant">GL_TEXTURE_3D</code>, <code class="constant">GL_TEXTURE_1D_ARRAY</code>, |
| 36 | <code class="constant">GL_TEXTURE_2D_ARRAY</code>, <code class="constant">GL_TEXTURE_RECTANGLE</code>, |
| 37 | or <code class="constant">GL_TEXTURE_CUBE_MAP</code>. |
| 38 | </p></dd><dt><span class="term"><em class="parameter"><code>pname</code></em></span></dt><dd><p> |
| 39 | Specifies the symbolic name of a texture parameter. |
| 40 | <em class="parameter"><code>pname</code></em> can be one of the following: |
| 41 | <code class="constant">GL_DEPTH_STENCIL_TEXTURE_MODE</code>, |
| 42 | <code class="constant">GL_TEXTURE_BASE_LEVEL</code>, |
| 43 | <code class="constant">GL_TEXTURE_BORDER_COLOR</code>, |
| 44 | <code class="constant">GL_TEXTURE_COMPARE_FUNC</code>, |
| 45 | <code class="constant">GL_TEXTURE_COMPARE_MODE</code>, |
| 46 | <code class="constant">GL_TEXTURE_LOD_BIAS</code>, |
| 47 | <code class="constant">GL_TEXTURE_MIN_FILTER</code>, |
| 48 | <code class="constant">GL_TEXTURE_MAG_FILTER</code>, |
| 49 | <code class="constant">GL_TEXTURE_MIN_LOD</code>, |
| 50 | <code class="constant">GL_TEXTURE_MAX_LOD</code>, |
| 51 | <code class="constant">GL_TEXTURE_MAX_LEVEL</code>, |
| 52 | <code class="constant">GL_TEXTURE_SWIZZLE_R</code>, |
| 53 | <code class="constant">GL_TEXTURE_SWIZZLE_G</code>, |
| 54 | <code class="constant">GL_TEXTURE_SWIZZLE_B</code>, |
| 55 | <code class="constant">GL_TEXTURE_SWIZZLE_A</code>, |
| 56 | <code class="constant">GL_TEXTURE_SWIZZLE_RGBA</code>, |
| 57 | <code class="constant">GL_TEXTURE_WRAP_S</code>, |
| 58 | <code class="constant">GL_TEXTURE_WRAP_T</code>, or |
| 59 | <code class="constant">GL_TEXTURE_WRAP_R</code>. |
| 60 | </p></dd><dt><span class="term"><em class="parameter"><code>params</code></em></span></dt><dd><p> |
| 61 | Specifies a pointer to an array where the value or values of <em class="parameter"><code>pname</code></em> |
| 62 | are stored. |
| 63 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> |
| 64 | <code class="function">glTexParameter</code> assigns the value or values in <em class="parameter"><code>params</code></em> to the texture parameter |
| 65 | specified as <em class="parameter"><code>pname</code></em>. |
| 66 | <em class="parameter"><code>target</code></em> defines the target texture, |
| 67 | either <code class="constant">GL_TEXTURE_1D</code>, <code class="constant">GL_TEXTURE_2D</code>, <code class="constant">GL_TEXTURE_1D_ARRAY</code>, |
| 68 | <code class="constant">GL_TEXTURE_2D_ARRAY</code>, <code class="constant">GL_TEXTURE_RECTANGLE</code>, or <code class="constant">GL_TEXTURE_3D</code>. |
| 69 | The following symbols are accepted in <em class="parameter"><code>pname</code></em>: |
| 70 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_DEPTH_STENCIL_TEXTURE_MODE</code></span></dt><dd><p> |
| 71 | Specifies the mode used to read from depth-stencil format textures. <em class="parameter"><code>params</code></em> |
| 72 | must be one of <code class="constant">GL_DEPTH_COMPONENT</code> or <code class="constant">GL_STENCIL_COMPONENT</code>. |
| 73 | If the depth stencil mode is <code class="constant">GL_DEPTH_COMPONENT</code>, then reads from depth-stencil |
| 74 | format textures will return the depth component of the texel in |
| 75 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:msub><mml:mi>R</mml:mi><mml:mi>t</mml:mi></mml:msub></mml:math> and the stencil component |
| 76 | will be discarded. If the depth stencil mode is <code class="constant">GL_STENCIL_COMPONENT</code> then |
| 77 | the stencil component is returned in <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:msub><mml:mi>R</mml:mi><mml:mi>t</mml:mi></mml:msub></mml:math> |
| 78 | and the depth component is discarded. The initial value is <code class="constant">GL_DEPTH_COMPONENT</code>. |
| 79 | </p></dd></dl></div><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_BASE_LEVEL</code></span></dt><dd><p> |
| 80 | Specifies the index of the lowest defined mipmap level. This is an |
| 81 | integer value. The initial value is 0. |
| 82 | </p></dd></dl></div><p> |
| 83 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_BORDER_COLOR</code></span></dt><dd><p> |
| 84 | The data in <em class="parameter"><code>params</code></em> specifies four values that define the border values that |
| 85 | should be used for border texels. If a texel is sampled from the border of the texture, the |
| 86 | values of <code class="constant">GL_TEXTURE_BORDER_COLOR</code> are interpreted as an RGBA color to match the |
| 87 | texture's internal format and substituted for the non-existent texel data. If the texture contains depth |
| 88 | components, the first component of <code class="constant">GL_TEXTURE_BORDER_COLOR</code> is interpreted as a depth value. |
| 89 | The initial value is |
| 90 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 91 | <mml:mrow> |
| 92 | <mml:mfenced open="(" close=")"> |
| 93 | <mml:mrow> |
| 94 | 0.0, 0.0, 0.0, 0.0 |
| 95 | </mml:mrow> |
| 96 | </mml:mfenced> |
| 97 | </mml:mrow> |
| 98 | </mml:math>. |
| 99 | </p><p> |
| 100 | If the values for <code class="constant">GL_TEXTURE_BORDER_COLOR</code> are specified with <code class="function">glTexParameterIiv</code> |
| 101 | or <code class="function">glTexParameterIuiv</code>, the values are stored unmodified with an internal data type of |
| 102 | integer. If specified with <code class="function">glTexParameteriv</code>, they are converted to floating point with the following |
| 103 | equation: |
| 104 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 105 | <mml:mrow> |
| 106 | <mml:mi mathvariant="italic">f</mml:mi> |
| 107 | <mml:mo>=</mml:mo> |
| 108 | <mml:mfrac> |
| 109 | <mml:mrow> |
| 110 | <mml:msub><mml:mn>2</mml:mn> |
| 111 | <mml:mi mathvariant="italic">c</mml:mi> |
| 112 | </mml:msub> |
| 113 | <mml:mo>+</mml:mo> |
| 114 | <mml:mn>1</mml:mn> |
| 115 | </mml:mrow> |
| 116 | <mml:mrow> |
| 117 | <mml:msup><mml:mn>2</mml:mn> |
| 118 | <mml:mi mathvariant="italic">b</mml:mi> |
| 119 | </mml:msup> |
| 120 | <mml:mo>-</mml:mo> |
| 121 | <mml:mn>1</mml:mn> |
| 122 | </mml:mrow> |
| 123 | </mml:mfrac> |
| 124 | </mml:mrow> |
| 125 | </mml:math>. |
| 126 | If specified with <code class="function">glTexParameterfv</code>, they are stored unmodified as floating-point values. |
| 127 | </p></dd><dt><span class="term"><code class="constant">GL_TEXTURE_COMPARE_FUNC</code></span></dt><dd><p> |
| 128 | Specifies the comparison operator used when <code class="constant">GL_TEXTURE_COMPARE_MODE</code> is |
| 129 | set to <code class="constant">GL_COMPARE_REF_TO_TEXTURE</code>. Permissible values are: |
| 130 | </p><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left"><span class="bold"><strong> |
| 131 | Texture Comparison Function |
| 132 | </strong></span></th><th align="left"><span class="bold"><strong> |
| 133 | Computed result |
| 134 | </strong></span></th></tr></thead><tbody><tr><td align="left"> |
| 135 | <code class="constant">GL_LEQUAL</code> |
| 136 | </td><td align="left"> |
| 137 | <div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 138 | |
| 139 | <mml:mrow> |
| 140 | <mml:mi mathvariant="italic">result</mml:mi> |
| 141 | <mml:mo>=</mml:mo> |
| 142 | <mml:mfenced open="{" close=""> |
| 143 | <mml:mrow> |
| 144 | <mml:mtable> |
| 145 | <mml:mtr><mml:mtd> |
| 146 | <mml:mn>1.0</mml:mn> |
| 147 | </mml:mtd></mml:mtr> |
| 148 | <mml:mtr><mml:mtd> |
| 149 | <mml:mn>0.0</mml:mn> |
| 150 | </mml:mtd></mml:mtr> |
| 151 | </mml:mtable> |
| 152 | <mml:mo> </mml:mo> |
| 153 | <mml:mtable> |
| 154 | <mml:mtr><mml:mtd> |
| 155 | <mml:mrow> |
| 156 | <mml:mi mathvariant="italic">r</mml:mi> |
| 157 | <mml:mo><=</mml:mo> |
| 158 | <mml:mfenced open="" close=""> |
| 159 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 160 | <mml:mi mathvariant="italic">t</mml:mi> |
| 161 | </mml:msub> |
| 162 | </mml:mfenced> |
| 163 | </mml:mrow> |
| 164 | </mml:mtd></mml:mtr> |
| 165 | <mml:mtr><mml:mtd> |
| 166 | <mml:mrow> |
| 167 | <mml:mi mathvariant="italic">r</mml:mi> |
| 168 | <mml:mo>></mml:mo> |
| 169 | <mml:mfenced open="" close=""> |
| 170 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 171 | <mml:mi mathvariant="italic">t</mml:mi> |
| 172 | </mml:msub> |
| 173 | </mml:mfenced> |
| 174 | </mml:mrow> |
| 175 | </mml:mtd></mml:mtr> |
| 176 | </mml:mtable> |
| 177 | </mml:mrow> |
| 178 | </mml:mfenced> |
| 179 | </mml:mrow> |
| 180 | </mml:math></div> |
| 181 | </td></tr><tr><td align="left"> |
| 182 | <code class="constant">GL_GEQUAL</code> |
| 183 | </td><td align="left"> |
| 184 | <div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 185 | |
| 186 | <mml:mrow> |
| 187 | <mml:mi mathvariant="italic">result</mml:mi> |
| 188 | <mml:mo>=</mml:mo> |
| 189 | <mml:mfenced open="{" close=""> |
| 190 | <mml:mrow> |
| 191 | <mml:mtable> |
| 192 | <mml:mtr><mml:mtd> |
| 193 | <mml:mn>1.0</mml:mn> |
| 194 | </mml:mtd></mml:mtr> |
| 195 | <mml:mtr><mml:mtd> |
| 196 | <mml:mn>0.0</mml:mn> |
| 197 | </mml:mtd></mml:mtr> |
| 198 | </mml:mtable> |
| 199 | <mml:mo> </mml:mo> |
| 200 | <mml:mtable> |
| 201 | <mml:mtr><mml:mtd> |
| 202 | <mml:mrow> |
| 203 | <mml:mi mathvariant="italic">r</mml:mi> |
| 204 | <mml:mo>>=</mml:mo> |
| 205 | <mml:mfenced open="" close=""> |
| 206 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 207 | <mml:mi mathvariant="italic">t</mml:mi> |
| 208 | </mml:msub> |
| 209 | </mml:mfenced> |
| 210 | </mml:mrow> |
| 211 | </mml:mtd></mml:mtr> |
| 212 | <mml:mtr><mml:mtd> |
| 213 | <mml:mrow> |
| 214 | <mml:mi mathvariant="italic">r</mml:mi> |
| 215 | <mml:mo><</mml:mo> |
| 216 | <mml:mfenced open="" close=""> |
| 217 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 218 | <mml:mi mathvariant="italic">t</mml:mi> |
| 219 | </mml:msub> |
| 220 | </mml:mfenced> |
| 221 | </mml:mrow> |
| 222 | </mml:mtd></mml:mtr> |
| 223 | </mml:mtable> |
| 224 | </mml:mrow> |
| 225 | </mml:mfenced> |
| 226 | </mml:mrow> |
| 227 | </mml:math></div> |
| 228 | </td></tr><tr><td align="left"> |
| 229 | <code class="constant">GL_LESS</code> |
| 230 | </td><td align="left"> |
| 231 | <div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 232 | |
| 233 | <mml:mrow> |
| 234 | <mml:mi mathvariant="italic">result</mml:mi> |
| 235 | <mml:mo>=</mml:mo> |
| 236 | <mml:mfenced open="{" close=""> |
| 237 | <mml:mrow> |
| 238 | <mml:mtable> |
| 239 | <mml:mtr><mml:mtd> |
| 240 | <mml:mn>1.0</mml:mn> |
| 241 | </mml:mtd></mml:mtr> |
| 242 | <mml:mtr><mml:mtd> |
| 243 | <mml:mn>0.0</mml:mn> |
| 244 | </mml:mtd></mml:mtr> |
| 245 | </mml:mtable> |
| 246 | <mml:mo> </mml:mo> |
| 247 | <mml:mtable> |
| 248 | <mml:mtr><mml:mtd> |
| 249 | <mml:mrow> |
| 250 | <mml:mi mathvariant="italic">r</mml:mi> |
| 251 | <mml:mo><</mml:mo> |
| 252 | <mml:mfenced open="" close=""> |
| 253 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 254 | <mml:mi mathvariant="italic">t</mml:mi> |
| 255 | </mml:msub> |
| 256 | </mml:mfenced> |
| 257 | </mml:mrow> |
| 258 | </mml:mtd></mml:mtr> |
| 259 | <mml:mtr><mml:mtd> |
| 260 | <mml:mrow> |
| 261 | <mml:mi mathvariant="italic">r</mml:mi> |
| 262 | <mml:mo>>=</mml:mo> |
| 263 | <mml:mfenced open="" close=""> |
| 264 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 265 | <mml:mi mathvariant="italic">t</mml:mi> |
| 266 | </mml:msub> |
| 267 | </mml:mfenced> |
| 268 | </mml:mrow> |
| 269 | </mml:mtd></mml:mtr> |
| 270 | </mml:mtable> |
| 271 | </mml:mrow> |
| 272 | </mml:mfenced> |
| 273 | </mml:mrow> |
| 274 | </mml:math></div> |
| 275 | </td></tr><tr><td align="left"> |
| 276 | <code class="constant">GL_GREATER</code> |
| 277 | </td><td align="left"> |
| 278 | <div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 279 | |
| 280 | <mml:mrow> |
| 281 | <mml:mi mathvariant="italic">result</mml:mi> |
| 282 | <mml:mo>=</mml:mo> |
| 283 | <mml:mfenced open="{" close=""> |
| 284 | <mml:mrow> |
| 285 | <mml:mtable> |
| 286 | <mml:mtr><mml:mtd> |
| 287 | <mml:mn>1.0</mml:mn> |
| 288 | </mml:mtd></mml:mtr> |
| 289 | <mml:mtr><mml:mtd> |
| 290 | <mml:mn>0.0</mml:mn> |
| 291 | </mml:mtd></mml:mtr> |
| 292 | </mml:mtable> |
| 293 | <mml:mo> </mml:mo> |
| 294 | <mml:mtable> |
| 295 | <mml:mtr><mml:mtd> |
| 296 | <mml:mrow> |
| 297 | <mml:mi mathvariant="italic">r</mml:mi> |
| 298 | <mml:mo>></mml:mo> |
| 299 | <mml:mfenced open="" close=""> |
| 300 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 301 | <mml:mi mathvariant="italic">t</mml:mi> |
| 302 | </mml:msub> |
| 303 | </mml:mfenced> |
| 304 | </mml:mrow> |
| 305 | </mml:mtd></mml:mtr> |
| 306 | <mml:mtr><mml:mtd> |
| 307 | <mml:mrow> |
| 308 | <mml:mi mathvariant="italic">r</mml:mi> |
| 309 | <mml:mo><=</mml:mo> |
| 310 | <mml:mfenced open="" close=""> |
| 311 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 312 | <mml:mi mathvariant="italic">t</mml:mi> |
| 313 | </mml:msub> |
| 314 | </mml:mfenced> |
| 315 | </mml:mrow> |
| 316 | </mml:mtd></mml:mtr> |
| 317 | </mml:mtable> |
| 318 | </mml:mrow> |
| 319 | </mml:mfenced> |
| 320 | </mml:mrow> |
| 321 | </mml:math></div> |
| 322 | </td></tr><tr><td align="left"> |
| 323 | <code class="constant">GL_EQUAL</code> |
| 324 | </td><td align="left"> |
| 325 | <div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 326 | |
| 327 | <mml:mrow> |
| 328 | <mml:mi mathvariant="italic">result</mml:mi> |
| 329 | <mml:mo>=</mml:mo> |
| 330 | <mml:mfenced open="{" close=""> |
| 331 | <mml:mrow> |
| 332 | <mml:mtable> |
| 333 | <mml:mtr><mml:mtd> |
| 334 | <mml:mn>1.0</mml:mn> |
| 335 | </mml:mtd></mml:mtr> |
| 336 | <mml:mtr><mml:mtd> |
| 337 | <mml:mn>0.0</mml:mn> |
| 338 | </mml:mtd></mml:mtr> |
| 339 | </mml:mtable> |
| 340 | <mml:mo> </mml:mo> |
| 341 | <mml:mtable> |
| 342 | <mml:mtr><mml:mtd> |
| 343 | <mml:mrow> |
| 344 | <mml:mi mathvariant="italic">r</mml:mi> |
| 345 | <mml:mo>=</mml:mo> |
| 346 | <mml:mfenced open="" close=""> |
| 347 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 348 | <mml:mi mathvariant="italic">t</mml:mi> |
| 349 | </mml:msub> |
| 350 | </mml:mfenced> |
| 351 | </mml:mrow> |
| 352 | </mml:mtd></mml:mtr> |
| 353 | <mml:mtr><mml:mtd> |
| 354 | <mml:mrow> |
| 355 | <mml:mi mathvariant="italic">r</mml:mi> |
| 356 | <mml:mo>≠</mml:mo> |
| 357 | <mml:mfenced open="" close=""> |
| 358 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 359 | <mml:mi mathvariant="italic">t</mml:mi> |
| 360 | </mml:msub> |
| 361 | </mml:mfenced> |
| 362 | </mml:mrow> |
| 363 | </mml:mtd></mml:mtr> |
| 364 | </mml:mtable> |
| 365 | </mml:mrow> |
| 366 | </mml:mfenced> |
| 367 | </mml:mrow> |
| 368 | </mml:math></div> |
| 369 | </td></tr><tr><td align="left"> |
| 370 | <code class="constant">GL_NOTEQUAL</code> |
| 371 | </td><td align="left"> |
| 372 | <div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 373 | |
| 374 | <mml:mrow> |
| 375 | <mml:mi mathvariant="italic">result</mml:mi> |
| 376 | <mml:mo>=</mml:mo> |
| 377 | <mml:mfenced open="{" close=""> |
| 378 | <mml:mrow> |
| 379 | <mml:mtable> |
| 380 | <mml:mtr><mml:mtd> |
| 381 | <mml:mn>1.0</mml:mn> |
| 382 | </mml:mtd></mml:mtr> |
| 383 | <mml:mtr><mml:mtd> |
| 384 | <mml:mn>0.0</mml:mn> |
| 385 | </mml:mtd></mml:mtr> |
| 386 | </mml:mtable> |
| 387 | <mml:mo> </mml:mo> |
| 388 | <mml:mtable> |
| 389 | <mml:mtr><mml:mtd> |
| 390 | <mml:mrow> |
| 391 | <mml:mi mathvariant="italic">r</mml:mi> |
| 392 | <mml:mo>≠</mml:mo> |
| 393 | <mml:mfenced open="" close=""> |
| 394 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 395 | <mml:mi mathvariant="italic">t</mml:mi> |
| 396 | </mml:msub> |
| 397 | </mml:mfenced> |
| 398 | </mml:mrow> |
| 399 | </mml:mtd></mml:mtr> |
| 400 | <mml:mtr><mml:mtd> |
| 401 | <mml:mrow> |
| 402 | <mml:mi mathvariant="italic">r</mml:mi> |
| 403 | <mml:mo>=</mml:mo> |
| 404 | <mml:mfenced open="" close=""> |
| 405 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 406 | <mml:mi mathvariant="italic">t</mml:mi> |
| 407 | </mml:msub> |
| 408 | </mml:mfenced> |
| 409 | </mml:mrow> |
| 410 | </mml:mtd></mml:mtr> |
| 411 | </mml:mtable> |
| 412 | </mml:mrow> |
| 413 | </mml:mfenced> |
| 414 | </mml:mrow> |
| 415 | </mml:math></div> |
| 416 | </td></tr><tr><td align="left"> |
| 417 | <code class="constant">GL_ALWAYS</code> |
| 418 | </td><td align="left"> |
| 419 | <div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 420 | <mml:mrow> |
| 421 | <mml:mi mathvariant="italic">result</mml:mi> |
| 422 | <mml:mo>=</mml:mo> |
| 423 | <mml:mi>1.0</mml:mi> |
| 424 | </mml:mrow> |
| 425 | </mml:math></div> |
| 426 | </td></tr><tr><td align="left"> |
| 427 | <code class="constant">GL_NEVER</code> |
| 428 | </td><td align="left"> |
| 429 | <div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 430 | <mml:mrow> |
| 431 | <mml:mi mathvariant="italic">result</mml:mi> |
| 432 | <mml:mo>=</mml:mo> |
| 433 | <mml:mi>0.0</mml:mi> |
| 434 | </mml:mrow> |
| 435 | </mml:math></div> |
| 436 | </td></tr></tbody></table></div><p> |
| 437 | where <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> |
| 438 | is the current interpolated texture coordinate, and |
| 439 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 440 | |
| 441 | <mml:msub><mml:mi mathvariant="italic">D</mml:mi> |
| 442 | <mml:mi mathvariant="italic">t</mml:mi> |
| 443 | </mml:msub> |
| 444 | </mml:math> |
| 445 | is the depth texture value sampled from the currently bound depth texture. |
| 446 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">result</mml:mi></mml:math> |
| 447 | is assigned to the the red channel. |
| 448 | </p></dd><dt><span class="term"><code class="constant">GL_TEXTURE_COMPARE_MODE</code></span></dt><dd><p> |
| 449 | Specifies the texture comparison mode for currently bound depth textures. |
| 450 | That is, a texture whose internal format is <code class="constant">GL_DEPTH_COMPONENT_*</code>; see |
| 451 | <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>) |
| 452 | Permissible values are: |
| 453 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_COMPARE_REF_TO_TEXTURE</code></span></dt><dd><p> |
| 454 | Specifies that the interpolated and clamped |
| 455 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> |
| 456 | texture coordinate should |
| 457 | be compared to the value in the currently bound depth texture. See the |
| 458 | discussion of <code class="constant">GL_TEXTURE_COMPARE_FUNC</code> for details of how the comparison |
| 459 | is evaluated. The result of the comparison is assigned to the red channel. |
| 460 | </p></dd><dt><span class="term"><code class="constant">GL_NONE</code></span></dt><dd><p> |
| 461 | Specifies that the red channel should be assigned the |
| 462 | appropriate value from the currently bound depth texture. |
| 463 | </p></dd></dl></div><p> |
| 464 | </p></dd><dt><span class="term"><code class="constant">GL_TEXTURE_LOD_BIAS</code></span></dt><dd><p> |
| 465 | <em class="parameter"><code>params</code></em> specifies a fixed bias value that is to be added to the level-of-detail |
| 466 | parameter for the texture before texture sampling. The specified value is added to the shader-supplied |
| 467 | bias value (if any) and subsequently clamped into the implementation-defined range |
| 468 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 469 | <mml:mfenced open="[" close="]"> |
| 470 | <mml:mfenced open="" close=""> |
| 471 | <mml:mrow> |
| 472 | - |
| 473 | <mml:msub><mml:mi mathvariant="italic">bias</mml:mi> |
| 474 | <mml:mi mathvariant="italic">max</mml:mi> |
| 475 | </mml:msub> |
| 476 | </mml:mrow> |
| 477 | </mml:mfenced> |
| 478 | <mml:mrow> |
| 479 | <mml:mfenced open="" close=""> |
| 480 | <mml:mrow> |
| 481 | <mml:msub><mml:mi mathvariant="italic">bias</mml:mi> |
| 482 | <mml:mi mathvariant="italic">max</mml:mi> |
| 483 | </mml:msub> |
| 484 | </mml:mrow> |
| 485 | </mml:mfenced> |
| 486 | </mml:mrow> |
| 487 | </mml:mfenced> |
| 488 | </mml:math>, |
| 489 | where |
| 490 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 491 | <mml:mrow> |
| 492 | <mml:msub><mml:mi mathvariant="italic">bias</mml:mi> |
| 493 | <mml:mi mathvariant="italic">max</mml:mi> |
| 494 | </mml:msub> |
| 495 | </mml:mrow> |
| 496 | </mml:math> |
| 497 | is the value of the implementation defined constant <code class="constant">GL_MAX_TEXTURE_LOD_BIAS</code>. The initial value is 0.0. |
| 498 | </p></dd><dt><span class="term"><code class="constant">GL_TEXTURE_MIN_FILTER</code></span></dt><dd><p> |
| 499 | The texture minifying function is used whenever the level-of-detail function |
| 500 | used when sampling from the texture determines that the texture should be minified. |
| 501 | There are six defined minifying functions. |
| 502 | Two of them use either the nearest texture elements or a weighted average of multiple texture elements |
| 503 | to compute the texture value. |
| 504 | The other four use mipmaps. |
| 505 | </p><p> |
| 506 | A mipmap is an ordered set of arrays representing the same image |
| 507 | at progressively lower resolutions. |
| 508 | If the texture has dimensions |
| 509 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 510 | |
| 511 | <mml:mrow> |
| 512 | <mml:msup><mml:mn>2</mml:mn> |
| 513 | <mml:mi mathvariant="italic">n</mml:mi> |
| 514 | </mml:msup> |
| 515 | <mml:mo>×</mml:mo> |
| 516 | <mml:msup><mml:mn>2</mml:mn> |
| 517 | <mml:mi mathvariant="italic">m</mml:mi> |
| 518 | </mml:msup> |
| 519 | </mml:mrow> |
| 520 | </mml:math>, |
| 521 | there are |
| 522 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 523 | |
| 524 | <mml:mrow> |
| 525 | <mml:mrow> |
| 526 | <mml:mi mathvariant="italic">max</mml:mi> |
| 527 | <mml:mo></mml:mo> |
| 528 | <mml:mfenced open="(" close=")"> |
| 529 | <mml:mi mathvariant="italic">n</mml:mi> |
| 530 | <mml:mi mathvariant="italic">m</mml:mi> |
| 531 | </mml:mfenced> |
| 532 | </mml:mrow> |
| 533 | <mml:mo>+</mml:mo> |
| 534 | <mml:mn>1</mml:mn> |
| 535 | </mml:mrow> |
| 536 | </mml:math> |
| 537 | mipmaps. |
| 538 | The first mipmap is the original texture, |
| 539 | with dimensions |
| 540 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 541 | |
| 542 | <mml:mrow> |
| 543 | <mml:msup><mml:mn>2</mml:mn> |
| 544 | <mml:mi mathvariant="italic">n</mml:mi> |
| 545 | </mml:msup> |
| 546 | <mml:mo>×</mml:mo> |
| 547 | <mml:msup><mml:mn>2</mml:mn> |
| 548 | <mml:mi mathvariant="italic">m</mml:mi> |
| 549 | </mml:msup> |
| 550 | </mml:mrow> |
| 551 | </mml:math>. |
| 552 | Each subsequent mipmap has dimensions |
| 553 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 554 | |
| 555 | <mml:mrow> |
| 556 | <mml:msup><mml:mn>2</mml:mn> |
| 557 | <mml:mfenced open="" close=""> |
| 558 | <mml:mrow> |
| 559 | <mml:mi mathvariant="italic">k</mml:mi> |
| 560 | <mml:mo>-</mml:mo> |
| 561 | <mml:mn>1</mml:mn> |
| 562 | </mml:mrow> |
| 563 | </mml:mfenced> |
| 564 | </mml:msup> |
| 565 | <mml:mo>×</mml:mo> |
| 566 | <mml:msup><mml:mn>2</mml:mn> |
| 567 | <mml:mfenced open="" close=""> |
| 568 | <mml:mrow> |
| 569 | <mml:mi mathvariant="italic">l</mml:mi> |
| 570 | <mml:mo>-</mml:mo> |
| 571 | <mml:mn>1</mml:mn> |
| 572 | </mml:mrow> |
| 573 | </mml:mfenced> |
| 574 | </mml:msup> |
| 575 | </mml:mrow> |
| 576 | </mml:math>, |
| 577 | where |
| 578 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 579 | |
| 580 | <mml:mrow> |
| 581 | <mml:msup><mml:mn>2</mml:mn> |
| 582 | <mml:mi mathvariant="italic">k</mml:mi> |
| 583 | </mml:msup> |
| 584 | <mml:mo>×</mml:mo> |
| 585 | <mml:msup><mml:mn>2</mml:mn> |
| 586 | <mml:mi mathvariant="italic">l</mml:mi> |
| 587 | </mml:msup> |
| 588 | </mml:mrow> |
| 589 | </mml:math> |
| 590 | are the dimensions of the previous mipmap, |
| 591 | until either |
| 592 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 593 | |
| 594 | <mml:mrow> |
| 595 | <mml:mi mathvariant="italic">k</mml:mi> |
| 596 | <mml:mo>=</mml:mo> |
| 597 | <mml:mn>0</mml:mn> |
| 598 | </mml:mrow> |
| 599 | </mml:math> |
| 600 | or |
| 601 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 602 | |
| 603 | <mml:mrow> |
| 604 | <mml:mi mathvariant="italic">l</mml:mi> |
| 605 | <mml:mo>=</mml:mo> |
| 606 | <mml:mn>0</mml:mn> |
| 607 | </mml:mrow> |
| 608 | </mml:math>. |
| 609 | At that point, |
| 610 | subsequent mipmaps have dimension |
| 611 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 612 | |
| 613 | <mml:mrow> |
| 614 | <mml:mn>1</mml:mn> |
| 615 | <mml:mo>×</mml:mo> |
| 616 | <mml:msup><mml:mn>2</mml:mn> |
| 617 | <mml:mfenced open="" close=""> |
| 618 | <mml:mrow> |
| 619 | <mml:mi mathvariant="italic">l</mml:mi> |
| 620 | <mml:mo>-</mml:mo> |
| 621 | <mml:mn>1</mml:mn> |
| 622 | </mml:mrow> |
| 623 | </mml:mfenced> |
| 624 | </mml:msup> |
| 625 | </mml:mrow> |
| 626 | </mml:math> |
| 627 | or |
| 628 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 629 | |
| 630 | <mml:mrow> |
| 631 | <mml:msup><mml:mn>2</mml:mn> |
| 632 | <mml:mfenced open="" close=""> |
| 633 | <mml:mrow> |
| 634 | <mml:mi mathvariant="italic">k</mml:mi> |
| 635 | <mml:mo>-</mml:mo> |
| 636 | <mml:mn>1</mml:mn> |
| 637 | </mml:mrow> |
| 638 | </mml:mfenced> |
| 639 | </mml:msup> |
| 640 | <mml:mo>×</mml:mo> |
| 641 | <mml:mn>1</mml:mn> |
| 642 | </mml:mrow> |
| 643 | </mml:math> |
| 644 | until the final mipmap, |
| 645 | which has dimension |
| 646 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 647 | |
| 648 | <mml:mrow> |
| 649 | <mml:mn>1</mml:mn> |
| 650 | <mml:mo>×</mml:mo> |
| 651 | <mml:mn>1</mml:mn> |
| 652 | </mml:mrow> |
| 653 | </mml:math>. |
| 654 | To define the mipmaps, call <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>, <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>, |
| 655 | <a href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>, |
| 656 | <a href="glCopyTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage1D</span></span></a>, or <a href="glCopyTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a> |
| 657 | with the <span class="emphasis"><em>level</em></span> argument indicating the order of the mipmaps. |
| 658 | Level 0 is the original texture; |
| 659 | level |
| 660 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 661 | |
| 662 | <mml:mrow> |
| 663 | <mml:mi mathvariant="italic">max</mml:mi> |
| 664 | <mml:mo></mml:mo> |
| 665 | <mml:mfenced open="(" close=")"> |
| 666 | <mml:mi mathvariant="italic">n</mml:mi> |
| 667 | <mml:mi mathvariant="italic">m</mml:mi> |
| 668 | </mml:mfenced> |
| 669 | </mml:mrow> |
| 670 | </mml:math> |
| 671 | is the final |
| 672 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 673 | |
| 674 | <mml:mrow> |
| 675 | <mml:mn>1</mml:mn> |
| 676 | <mml:mo>×</mml:mo> |
| 677 | <mml:mn>1</mml:mn> |
| 678 | </mml:mrow> |
| 679 | </mml:math> |
| 680 | mipmap. |
| 681 | </p><p> |
| 682 | <em class="parameter"><code>params</code></em> supplies a function for minifying the texture as one of the |
| 683 | following: |
| 684 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_NEAREST</code></span></dt><dd><p> |
| 685 | Returns the value of the texture element that is nearest |
| 686 | (in Manhattan distance) |
| 687 | to the specified texture coordinates. |
| 688 | </p></dd><dt><span class="term"><code class="constant">GL_LINEAR</code></span></dt><dd><p> |
| 689 | Returns the weighted average of the four texture elements |
| 690 | that are closest to the specified texture coordinates. |
| 691 | These can include items wrapped or repeated from other parts of a texture, |
| 692 | depending on the values of <code class="constant">GL_TEXTURE_WRAP_S</code> and <code class="constant">GL_TEXTURE_WRAP_T</code>, |
| 693 | and on the exact mapping. |
| 694 | </p></dd><dt><span class="term"><code class="constant">GL_NEAREST_MIPMAP_NEAREST</code></span></dt><dd><p> |
| 695 | Chooses the mipmap that most closely matches the size of the pixel |
| 696 | being textured and uses the <code class="constant">GL_NEAREST</code> criterion |
| 697 | (the texture element closest to the specified texture coordinates) |
| 698 | to produce a texture value. |
| 699 | </p></dd><dt><span class="term"><code class="constant">GL_LINEAR_MIPMAP_NEAREST</code></span></dt><dd><p> |
| 700 | Chooses the mipmap that most closely matches the size of the pixel |
| 701 | being textured and uses the <code class="constant">GL_LINEAR</code> criterion |
| 702 | (a weighted average of the four texture elements that are closest to the specified texture coordinates) |
| 703 | to produce a texture value. |
| 704 | </p></dd><dt><span class="term"><code class="constant">GL_NEAREST_MIPMAP_LINEAR</code></span></dt><dd><p> |
| 705 | Chooses the two mipmaps that most closely match the size of the pixel |
| 706 | being textured and uses the <code class="constant">GL_NEAREST</code> criterion |
| 707 | (the texture element closest to the specified texture coordinates ) |
| 708 | to produce a texture value from each mipmap. |
| 709 | The final texture value is a weighted average of those two values. |
| 710 | </p></dd><dt><span class="term"><code class="constant">GL_LINEAR_MIPMAP_LINEAR</code></span></dt><dd><p> |
| 711 | Chooses the two mipmaps that most closely match the size of the pixel |
| 712 | being textured and uses the <code class="constant">GL_LINEAR</code> criterion |
| 713 | (a weighted average of the texture elements that are closest to the specified texture coordinates) |
| 714 | to produce a texture value from each mipmap. |
| 715 | The final texture value is a weighted average of those two values. |
| 716 | </p></dd></dl></div><p> |
| 717 | </p><p> |
| 718 | As more texture elements are sampled in the minification process, |
| 719 | fewer aliasing artifacts will be apparent. |
| 720 | While the <code class="constant">GL_NEAREST</code> and <code class="constant">GL_LINEAR</code> minification functions can be |
| 721 | faster than the other four, |
| 722 | they sample only one or multiple texture elements to determine the texture value |
| 723 | of the pixel being rendered and can produce moire patterns |
| 724 | or ragged transitions. |
| 725 | The initial value of <code class="constant">GL_TEXTURE_MIN_FILTER</code> is |
| 726 | <code class="constant">GL_NEAREST_MIPMAP_LINEAR</code>. |
| 727 | </p></dd></dl></div><p> |
| 728 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_MAG_FILTER</code></span></dt><dd><p> |
| 729 | The texture magnification function is used whenever the level-of-detail function |
| 730 | used when sampling from the texture determines that the texture should be magified. |
| 731 | It sets the texture magnification function to either <code class="constant">GL_NEAREST</code> |
| 732 | or <code class="constant">GL_LINEAR</code> (see below). <code class="constant">GL_NEAREST</code> is generally faster |
| 733 | than <code class="constant">GL_LINEAR</code>, |
| 734 | but it can produce textured images with sharper edges |
| 735 | because the transition between texture elements is not as smooth. |
| 736 | The initial value of <code class="constant">GL_TEXTURE_MAG_FILTER</code> is <code class="constant">GL_LINEAR</code>. |
| 737 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_NEAREST</code></span></dt><dd><p> |
| 738 | Returns the value of the texture element that is nearest |
| 739 | (in Manhattan distance) |
| 740 | to the specified texture coordinates. |
| 741 | </p></dd><dt><span class="term"><code class="constant">GL_LINEAR</code></span></dt><dd><p> |
| 742 | Returns the weighted average of the texture elements |
| 743 | that are closest to the specified texture coordinates. |
| 744 | These can include items wrapped or repeated from other parts of a texture, |
| 745 | depending on the values of <code class="constant">GL_TEXTURE_WRAP_S</code> and <code class="constant">GL_TEXTURE_WRAP_T</code>, |
| 746 | and on the exact mapping. |
| 747 | </p></dd></dl></div><p> |
| 748 | </p><p> |
| 749 | </p><p> |
| 750 | </p></dd></dl></div><p> |
| 751 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_MIN_LOD</code></span></dt><dd><p> |
| 752 | Sets the minimum level-of-detail parameter. This floating-point value |
| 753 | limits the selection of highest resolution mipmap (lowest mipmap |
| 754 | level). The initial value is -1000. |
| 755 | </p></dd></dl></div><p> |
| 756 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_MAX_LOD</code></span></dt><dd><p> |
| 757 | Sets the maximum level-of-detail parameter. This floating-point value |
| 758 | limits the selection of the lowest resolution mipmap (highest mipmap |
| 759 | level). The initial value is 1000. |
| 760 | </p></dd></dl></div><p> |
| 761 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_MAX_LEVEL</code></span></dt><dd><p> |
| 762 | Sets the index of the highest defined mipmap level. This is an integer |
| 763 | value. The initial value is 1000. |
| 764 | </p></dd></dl></div><p> |
| 765 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_SWIZZLE_R</code></span></dt><dd><p> |
| 766 | Sets the swizzle that will be applied to the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> |
| 767 | component of a texel before it is returned to the shader. Valid values for <em class="parameter"><code>param</code></em> are <code class="constant">GL_RED</code>, |
| 768 | <code class="constant">GL_GREEN</code>, <code class="constant">GL_BLUE</code>, <code class="constant">GL_ALPHA</code>, <code class="constant">GL_ZERO</code> and |
| 769 | <code class="constant">GL_ONE</code>. |
| 770 | If <code class="constant">GL_TEXTURE_SWIZZLE_R</code> is <code class="constant">GL_RED</code>, the value for |
| 771 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> will be taken from the first |
| 772 | channel of the fetched texel. |
| 773 | If <code class="constant">GL_TEXTURE_SWIZZLE_R</code> is <code class="constant">GL_GREEN</code>, the value for |
| 774 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> will be taken from the second |
| 775 | channel of the fetched texel. |
| 776 | If <code class="constant">GL_TEXTURE_SWIZZLE_R</code> is <code class="constant">GL_BLUE</code>, the value for |
| 777 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> will be taken from the third |
| 778 | channel of the fetched texel. |
| 779 | If <code class="constant">GL_TEXTURE_SWIZZLE_R</code> is <code class="constant">GL_ALPHA</code>, the value for |
| 780 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> will be taken from the fourth |
| 781 | channel of the fetched texel. |
| 782 | If <code class="constant">GL_TEXTURE_SWIZZLE_R</code> is <code class="constant">GL_ZERO</code>, the value for |
| 783 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> will be subtituted with |
| 784 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mn>0.0</mml:mn></mml:math>. |
| 785 | If <code class="constant">GL_TEXTURE_SWIZZLE_R</code> is <code class="constant">GL_ONE</code>, the value for |
| 786 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> will be subtituted with |
| 787 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mn>1.0</mml:mn></mml:math>. |
| 788 | The initial value is <code class="constant">GL_RED</code>. |
| 789 | </p></dd></dl></div><p> |
| 790 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_SWIZZLE_G</code></span></dt><dd><p> |
| 791 | Sets the swizzle that will be applied to the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">g</mml:mi></mml:math> |
| 792 | component of a texel before it is returned to the shader. Valid values for <em class="parameter"><code>param</code></em> and their effects are similar to |
| 793 | those of <code class="constant">GL_TEXTURE_SWIZZLE_R</code>. |
| 794 | The initial value is <code class="constant">GL_GREEN</code>. |
| 795 | </p></dd></dl></div><p> |
| 796 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_SWIZZLE_B</code></span></dt><dd><p> |
| 797 | Sets the swizzle that will be applied to the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">b</mml:mi></mml:math> |
| 798 | component of a texel before it is returned to the shader. Valid values for <em class="parameter"><code>param</code></em> and their effects are similar to |
| 799 | those of <code class="constant">GL_TEXTURE_SWIZZLE_R</code>. |
| 800 | The initial value is <code class="constant">GL_BLUE</code>. |
| 801 | </p></dd></dl></div><p> |
| 802 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_SWIZZLE_A</code></span></dt><dd><p> |
| 803 | Sets the swizzle that will be applied to the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">a</mml:mi></mml:math> |
| 804 | component of a texel before it is returned to the shader. Valid values for <em class="parameter"><code>param</code></em> and their effects are similar to |
| 805 | those of <code class="constant">GL_TEXTURE_SWIZZLE_R</code>. |
| 806 | The initial value is <code class="constant">GL_ALPHA</code>. |
| 807 | </p></dd></dl></div><p> |
| 808 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_SWIZZLE_RGBA</code></span></dt><dd><p> |
| 809 | Sets the swizzles that will be applied to the |
| 810 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math>, |
| 811 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">g</mml:mi></mml:math>, |
| 812 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">b</mml:mi></mml:math>, and |
| 813 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">a</mml:mi></mml:math> |
| 814 | components of a texel before they are returned to the shader. Valid values for <em class="parameter"><code>params</code></em> and their effects are similar to |
| 815 | those of <code class="constant">GL_TEXTURE_SWIZZLE_R</code>, except that all channels are specified simultaneously. |
| 816 | Setting the value of <code class="constant">GL_TEXTURE_SWIZZLE_RGBA</code> is equivalent (assuming no errors are generated) to |
| 817 | setting the parameters of each of <code class="constant">GL_TEXTURE_SWIZZLE_R</code>, |
| 818 | <code class="constant">GL_TEXTURE_SWIZZLE_G</code>, |
| 819 | <code class="constant">GL_TEXTURE_SWIZZLE_B</code>, and |
| 820 | <code class="constant">GL_TEXTURE_SWIZZLE_A</code> successively. |
| 821 | </p></dd></dl></div><p> |
| 822 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_WRAP_S</code></span></dt><dd><p> |
| 823 | Sets the wrap parameter for texture coordinate |
| 824 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math> |
| 825 | to either <code class="constant">GL_CLAMP_TO_EDGE</code>, <code class="constant">GL_CLAMP_TO_BORDER</code>, |
| 826 | <code class="constant">GL_MIRRORED_REPEAT</code>, or |
| 827 | <code class="constant">GL_REPEAT</code>. <code class="constant">GL_CLAMP_TO_EDGE</code> causes |
| 828 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math> |
| 829 | coordinates to be clamped to the |
| 830 | range |
| 831 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 832 | |
| 833 | <mml:mfenced open="[" close="]"> |
| 834 | <mml:mfenced open="" close=""> |
| 835 | <mml:mrow> |
| 836 | <mml:mfrac> |
| 837 | <mml:mn>1</mml:mn> |
| 838 | <mml:mn>2<mml:mi mathvariant="italic">N</mml:mi></mml:mn> |
| 839 | </mml:mfrac> |
| 840 | </mml:mrow> |
| 841 | </mml:mfenced> |
| 842 | <mml:mrow> |
| 843 | <mml:mn>1</mml:mn> |
| 844 | <mml:mo>-</mml:mo> |
| 845 | <mml:mfenced open="" close=""> |
| 846 | <mml:mrow> |
| 847 | <mml:mfrac> |
| 848 | <mml:mn>1</mml:mn> |
| 849 | <mml:mn>2<mml:mi mathvariant="italic">N</mml:mi></mml:mn> |
| 850 | </mml:mfrac> |
| 851 | </mml:mrow> |
| 852 | </mml:mfenced> |
| 853 | </mml:mrow> |
| 854 | </mml:mfenced> |
| 855 | </mml:math>, |
| 856 | where |
| 857 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">N</mml:mi></mml:math> |
| 858 | is the size |
| 859 | of the texture in the direction of clamping. |
| 860 | <code class="constant">GL_CLAMP_TO_BORDER</code> evaluates <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math> coordinates in a similar manner to <code class="constant">GL_CLAMP_TO_EDGE</code>. |
| 861 | However, in cases where clamping would have occurred in <code class="constant">GL_CLAMP_TO_EDGE</code> mode, the fetched texel data |
| 862 | is substituted with the values specified by <code class="constant">GL_TEXTURE_BORDER_COLOR</code>. |
| 863 | <code class="constant">GL_REPEAT</code> causes the |
| 864 | integer part of the |
| 865 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math> |
| 866 | coordinate to be ignored; the GL uses only the |
| 867 | fractional part, thereby creating a repeating pattern. |
| 868 | <code class="constant">GL_MIRRORED_REPEAT</code> causes the |
| 869 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math> |
| 870 | coordinate to be set to the |
| 871 | fractional part of the texture coordinate if the integer part of |
| 872 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math> |
| 873 | is |
| 874 | even; if the integer part of |
| 875 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math> |
| 876 | is odd, then the |
| 877 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math> |
| 878 | texture coordinate is |
| 879 | set to |
| 880 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 881 | |
| 882 | <mml:mrow> |
| 883 | <mml:mn>1</mml:mn> |
| 884 | <mml:mo>-</mml:mo> |
| 885 | <mml:mrow> |
| 886 | <mml:mi mathvariant="italic">frac</mml:mi> |
| 887 | <mml:mo></mml:mo> |
| 888 | <mml:mfenced open="(" close=")"> |
| 889 | <mml:mi mathvariant="italic">s</mml:mi> |
| 890 | </mml:mfenced> |
| 891 | </mml:mrow> |
| 892 | </mml:mrow> |
| 893 | </mml:math>, |
| 894 | where |
| 895 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 896 | |
| 897 | <mml:mrow> |
| 898 | <mml:mi mathvariant="italic">frac</mml:mi> |
| 899 | <mml:mo></mml:mo> |
| 900 | <mml:mfenced open="(" close=")"> |
| 901 | <mml:mi mathvariant="italic">s</mml:mi> |
| 902 | </mml:mfenced> |
| 903 | </mml:mrow> |
| 904 | </mml:math> |
| 905 | represents the fractional part of |
| 906 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math>. |
| 907 | Initially, <code class="constant">GL_TEXTURE_WRAP_S</code> is set to <code class="constant">GL_REPEAT</code>. |
| 908 | </p></dd></dl></div><p> |
| 909 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_WRAP_T</code></span></dt><dd><p> |
| 910 | Sets the wrap parameter for texture coordinate |
| 911 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">t</mml:mi></mml:math> |
| 912 | to either <code class="constant">GL_CLAMP_TO_EDGE</code>, <code class="constant">GL_CLAMP_TO_BORDER</code>, |
| 913 | <code class="constant">GL_MIRRORED_REPEAT</code>, or |
| 914 | <code class="constant">GL_REPEAT</code>. See the discussion under <code class="constant">GL_TEXTURE_WRAP_S</code>. |
| 915 | Initially, <code class="constant">GL_TEXTURE_WRAP_T</code> is set to <code class="constant">GL_REPEAT</code>. |
| 916 | </p></dd></dl></div><p> |
| 917 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_TEXTURE_WRAP_R</code></span></dt><dd><p> |
| 918 | Sets the wrap parameter for texture coordinate |
| 919 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">r</mml:mi></mml:math> |
| 920 | to either <code class="constant">GL_CLAMP_TO_EDGE</code>, <code class="constant">GL_CLAMP_TO_BORDER</code>, |
| 921 | <code class="constant">GL_MIRRORED_REPEAT</code>, or |
| 922 | <code class="constant">GL_REPEAT</code>. See the discussion under <code class="constant">GL_TEXTURE_WRAP_S</code>. |
| 923 | Initially, <code class="constant">GL_TEXTURE_WRAP_R</code> is set to <code class="constant">GL_REPEAT</code>. |
| 924 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> |
| 925 | Suppose that a program attempts to sample from a texture and |
| 926 | has set <code class="constant">GL_TEXTURE_MIN_FILTER</code> to one of the functions that requires a |
| 927 | mipmap. If either the dimensions of the texture images currently defined |
| 928 | (with previous calls to <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>, <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>, |
| 929 | <a href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>, <a href="glCopyTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage1D</span></span></a>, or <a href="glCopyTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>) do not |
| 930 | follow the proper sequence for mipmaps (described above), or there are |
| 931 | fewer texture images defined than are needed, or the set of texture images |
| 932 | have differing numbers of texture components, then the texture is considered <span class="emphasis"><em>incomplete</em></span>. |
| 933 | </p><p> |
| 934 | Linear filtering accesses the four nearest texture elements only in 2D |
| 935 | textures. In 1D textures, linear filtering accesses the two nearest |
| 936 | texture elements. In 3D textures, linear filtering accesses the eight nearest |
| 937 | texture elements. |
| 938 | </p><p> |
| 939 | <code class="function">glTexParameter</code> specifies the texture parameters for the active texture unit, specified |
| 940 | by calling <a href="glActiveTexture.xml"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>. |
| 941 | </p><p> |
| 942 | <code class="constant">GL_DEPTH_STENCIL_TEXTURE_MODE</code> is available only if the GL version is 4.3 or greater. |
| 943 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> |
| 944 | <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>target</code></em> or <em class="parameter"><code>pname</code></em> is not |
| 945 | one of the accepted defined values. |
| 946 | </p><p> |
| 947 | <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>params</code></em> should have a defined |
| 948 | constant value (based on the value of <em class="parameter"><code>pname</code></em>) and does not. |
| 949 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> |
| 950 | <a href="glGetTexParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexParameter</span></span></a> |
| 951 | </p><p> |
| 952 | <a href="glGetTexLevelParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a> |
| 953 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> |
| 954 | <a href="glActiveTexture.xml"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>, |
| 955 | <a href="glBindTexture.xml"><span class="citerefentry"><span class="refentrytitle">glBindTexture</span></span></a>, |
| 956 | <a href="glCopyTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage1D</span></span></a>, |
| 957 | <a href="glCopyTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>, |
| 958 | <a href="glCopyTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage1D</span></span></a>, |
| 959 | <a href="glCopyTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>, |
| 960 | <a href="glCopyTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage3D</span></span></a>, |
| 961 | <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>, |
| 962 | <a href="glSamplerParameter.xml"><span class="citerefentry"><span class="refentrytitle">glSamplerParameter</span></span></a>, |
| 963 | <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>, |
| 964 | <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>, |
| 965 | <a href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>, |
| 966 | <a href="glTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage1D</span></span></a>, |
| 967 | <a href="glTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage2D</span></span></a>, |
| 968 | <a href="glTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage3D</span></span></a> |
| 969 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> |
| 970 | Copyright <span class="trademark"></span>© 1991-2006 |
| 971 | Silicon Graphics, Inc. This document is licensed under the SGI |
| 972 | Free Software B License. For details, see |
| 973 | <a href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. |
| 974 | </p></div></div></body></html> |