include more low-level bindings
[clinton/guile-figl.git] / upstream-man-pages / man3 / glSamplerParameter.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id="glSamplerParameter">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2010</year>
9 <holder>KhronosGroup</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>glSamplerParameter</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>glSamplerParameter</refname>
17 <refpurpose>set sampler parameters</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>C Specification</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>void <function>glSamplerParameterf</function></funcdef>
23 <paramdef>GLuint <parameter>sampler</parameter></paramdef>
24 <paramdef>GLenum <parameter>pname</parameter></paramdef>
25 <paramdef>GLfloat <parameter>param</parameter></paramdef>
26 </funcprototype>
27 </funcsynopsis>
28 <funcsynopsis>
29 <funcprototype>
30 <funcdef>void <function>glSamplerParameteri</function></funcdef>
31 <paramdef>GLuint <parameter>sampler</parameter></paramdef>
32 <paramdef>GLenum <parameter>pname</parameter></paramdef>
33 <paramdef>GLint <parameter>param</parameter></paramdef>
34 </funcprototype>
35 </funcsynopsis>
36 </refsynopsisdiv>
37 <!-- eqn: ignoring delim $$ -->
38 <refsect1 id="parameters"><title>Parameters</title>
39 <variablelist>
40 <varlistentry>
41 <term><parameter>sampler</parameter></term>
42 <listitem>
43 <para>
44 Specifies the sampler object whose parameter to modify.
45 </para>
46 </listitem>
47 </varlistentry>
48 <varlistentry>
49 <term><parameter>pname</parameter></term>
50 <listitem>
51 <para>
52 Specifies the symbolic name of a single-valued sampler parameter.
53 <parameter>pname</parameter> can be one of the following:
54 <constant>GL_TEXTURE_WRAP_S</constant>,
55 <constant>GL_TEXTURE_WRAP_T</constant>,
56 <constant>GL_TEXTURE_WRAP_R</constant>,
57 <constant>GL_TEXTURE_MIN_FILTER</constant>,
58 <constant>GL_TEXTURE_MAG_FILTER</constant>,
59 <constant>GL_TEXTURE_MIN_LOD</constant>,
60 <constant>GL_TEXTURE_MAX_LOD</constant>,
61 <constant>GL_TEXTURE_LOD_BIAS</constant>
62 <constant>GL_TEXTURE_COMPARE_MODE</constant>, or
63 <constant>GL_TEXTURE_COMPARE_FUNC</constant>.
64 </para>
65 </listitem>
66 </varlistentry>
67 <varlistentry>
68 <term><parameter>param</parameter></term>
69 <listitem>
70 <para>
71 Specifies the value of <parameter>pname</parameter>.
72 </para>
73 </listitem>
74 </varlistentry>
75 </variablelist>
76 </refsect1>
77 <refsynopsisdiv><title>C Specification</title>
78 <funcsynopsis>
79 <funcprototype>
80 <funcdef>void <function>glSamplerParameterfv</function></funcdef>
81 <paramdef>GLuint <parameter>sampler</parameter></paramdef>
82 <paramdef>GLenum <parameter>pname</parameter></paramdef>
83 <paramdef>const GLfloat * <parameter>params</parameter></paramdef>
84 </funcprototype>
85 </funcsynopsis>
86 <funcsynopsis>
87 <funcprototype>
88 <funcdef>void <function>glSamplerParameteriv</function></funcdef>
89 <paramdef>GLuint <parameter>sampler</parameter></paramdef>
90 <paramdef>GLenum <parameter>pname</parameter></paramdef>
91 <paramdef>const GLint * <parameter>params</parameter></paramdef>
92 </funcprototype>
93 </funcsynopsis>
94 <funcsynopsis>
95 <funcprototype>
96 <funcdef>void <function>glSamplerParameterIiv</function></funcdef>
97 <paramdef>GLuint <parameter>sampler</parameter></paramdef>
98 <paramdef>GLenum <parameter>pname</parameter></paramdef>
99 <paramdef>const GLint * <parameter>params</parameter></paramdef>
100 </funcprototype>
101 </funcsynopsis>
102 <funcsynopsis>
103 <funcprototype>
104 <funcdef>void <function>glSamplerParameterIuiv</function></funcdef>
105 <paramdef>GLuint <parameter>sampler</parameter></paramdef>
106 <paramdef>GLenum <parameter>pname</parameter></paramdef>
107 <paramdef>const GLuint * <parameter>params</parameter></paramdef>
108 </funcprototype>
109 </funcsynopsis>
110 </refsynopsisdiv>
111 <refsect1 id="parameters2"><title>Parameters</title>
112 <variablelist>
113 <varlistentry>
114 <term><parameter>sampler</parameter></term>
115 <listitem>
116 <para>
117 Specifies the sampler object whose parameter to modify.
118 </para>
119 </listitem>
120 </varlistentry>
121 <varlistentry>
122 <term><parameter>pname</parameter></term>
123 <listitem>
124 <para>
125 Specifies the symbolic name of a sampler parameter.
126 <parameter>pname</parameter> can be one of the following:
127 <constant>GL_TEXTURE_WRAP_S</constant>,
128 <constant>GL_TEXTURE_WRAP_T</constant>,
129 <constant>GL_TEXTURE_WRAP_R</constant>,
130 <constant>GL_TEXTURE_MIN_FILTER</constant>,
131 <constant>GL_TEXTURE_MAG_FILTER</constant>,
132 <constant>GL_TEXTURE_BORDER_COLOR</constant>,
133 <constant>GL_TEXTURE_MIN_LOD</constant>,
134 <constant>GL_TEXTURE_MAX_LOD</constant>,
135 <constant>GL_TEXTURE_LOD_BIAS</constant>
136 <constant>GL_TEXTURE_COMPARE_MODE</constant>, or
137 <constant>GL_TEXTURE_COMPARE_FUNC</constant>.
138 </para>
139 </listitem>
140 </varlistentry>
141 <varlistentry>
142 <term><parameter>params</parameter></term>
143 <listitem>
144 <para>
145 Specifies a pointer to an array where the value or values of <parameter>pname</parameter>
146 are stored.
147 </para>
148 </listitem>
149 </varlistentry>
150 </variablelist>
151 </refsect1>
152 <refsect1 id="description"><title>Description</title>
153 <para>
154 <function>glSamplerParameter</function> assigns the value or values in <parameter>params</parameter> to the sampler parameter
155 specified as <parameter>pname</parameter>.
156 <parameter>sampler</parameter> specifies the sampler object to be modified, and must be the name of a sampler object previously
157 returned from a call to <citerefentry><refentrytitle>glGenSamplers</refentrytitle></citerefentry>.
158 The following symbols are accepted in <parameter>pname</parameter>:
159 </para>
160 <variablelist>
161 <varlistentry>
162 <term><constant>GL_TEXTURE_MIN_FILTER</constant></term>
163 <listitem>
164 <para>
165 The texture minifying function is used whenever the pixel being textured
166 maps to an area greater than one texture element.
167 There are six defined minifying functions.
168 Two of them use the nearest one or nearest four texture elements
169 to compute the texture value.
170 The other four use mipmaps.
171 </para>
172 <para>
173 A mipmap is an ordered set of arrays representing the same image
174 at progressively lower resolutions.
175 If the texture has dimensions
176 <inlineequation><mml:math>
177 <!-- eqn: 2 sup n times 2 sup m: -->
178 <mml:mrow>
179 <mml:msup><mml:mn>2</mml:mn>
180 <mml:mi mathvariant="italic">n</mml:mi>
181 </mml:msup>
182 <mml:mo>&times;</mml:mo>
183 <mml:msup><mml:mn>2</mml:mn>
184 <mml:mi mathvariant="italic">m</mml:mi>
185 </mml:msup>
186 </mml:mrow>
187 </mml:math></inlineequation>,
188 there are
189 <inlineequation><mml:math>
190 <!-- eqn: max ( n, m ) + 1: -->
191 <mml:mrow>
192 <mml:mrow>
193 <mml:mi mathvariant="italic">max</mml:mi>
194 <mml:mo>&af;</mml:mo>
195 <mml:mfenced open="(" close=")">
196 <mml:mi mathvariant="italic">n</mml:mi>
197 <mml:mi mathvariant="italic">m</mml:mi>
198 </mml:mfenced>
199 </mml:mrow>
200 <mml:mo>+</mml:mo>
201 <mml:mn>1</mml:mn>
202 </mml:mrow>
203 </mml:math></inlineequation>
204 mipmaps.
205 The first mipmap is the original texture,
206 with dimensions
207 <inlineequation><mml:math>
208 <!-- eqn: 2 sup n times 2 sup m: -->
209 <mml:mrow>
210 <mml:msup><mml:mn>2</mml:mn>
211 <mml:mi mathvariant="italic">n</mml:mi>
212 </mml:msup>
213 <mml:mo>&times;</mml:mo>
214 <mml:msup><mml:mn>2</mml:mn>
215 <mml:mi mathvariant="italic">m</mml:mi>
216 </mml:msup>
217 </mml:mrow>
218 </mml:math></inlineequation>.
219 Each subsequent mipmap has dimensions
220 <inlineequation><mml:math>
221 <!-- eqn: 2 sup { k - 1 } times 2 sup { l - 1 }: -->
222 <mml:mrow>
223 <mml:msup><mml:mn>2</mml:mn>
224 <mml:mfenced open="" close="">
225 <mml:mrow>
226 <mml:mi mathvariant="italic">k</mml:mi>
227 <mml:mo>-</mml:mo>
228 <mml:mn>1</mml:mn>
229 </mml:mrow>
230 </mml:mfenced>
231 </mml:msup>
232 <mml:mo>&times;</mml:mo>
233 <mml:msup><mml:mn>2</mml:mn>
234 <mml:mfenced open="" close="">
235 <mml:mrow>
236 <mml:mi mathvariant="italic">l</mml:mi>
237 <mml:mo>-</mml:mo>
238 <mml:mn>1</mml:mn>
239 </mml:mrow>
240 </mml:mfenced>
241 </mml:msup>
242 </mml:mrow>
243 </mml:math></inlineequation>,
244 where
245 <inlineequation><mml:math>
246 <!-- eqn: 2 sup k times 2 sup l: -->
247 <mml:mrow>
248 <mml:msup><mml:mn>2</mml:mn>
249 <mml:mi mathvariant="italic">k</mml:mi>
250 </mml:msup>
251 <mml:mo>&times;</mml:mo>
252 <mml:msup><mml:mn>2</mml:mn>
253 <mml:mi mathvariant="italic">l</mml:mi>
254 </mml:msup>
255 </mml:mrow>
256 </mml:math></inlineequation>
257 are the dimensions of the previous mipmap,
258 until either
259 <inlineequation><mml:math>
260 <!-- eqn: k = 0: -->
261 <mml:mrow>
262 <mml:mi mathvariant="italic">k</mml:mi>
263 <mml:mo>=</mml:mo>
264 <mml:mn>0</mml:mn>
265 </mml:mrow>
266 </mml:math></inlineequation>
267 or
268 <inlineequation><mml:math>
269 <!-- eqn: l = 0: -->
270 <mml:mrow>
271 <mml:mi mathvariant="italic">l</mml:mi>
272 <mml:mo>=</mml:mo>
273 <mml:mn>0</mml:mn>
274 </mml:mrow>
275 </mml:math></inlineequation>.
276 At that point,
277 subsequent mipmaps have dimension
278 <inlineequation><mml:math>
279 <!-- eqn: 1 times 2 sup { l - 1 }: -->
280 <mml:mrow>
281 <mml:mn>1</mml:mn>
282 <mml:mo>&times;</mml:mo>
283 <mml:msup><mml:mn>2</mml:mn>
284 <mml:mfenced open="" close="">
285 <mml:mrow>
286 <mml:mi mathvariant="italic">l</mml:mi>
287 <mml:mo>-</mml:mo>
288 <mml:mn>1</mml:mn>
289 </mml:mrow>
290 </mml:mfenced>
291 </mml:msup>
292 </mml:mrow>
293 </mml:math></inlineequation>
294 or
295 <inlineequation><mml:math>
296 <!-- eqn: 2 sup { k - 1} times 1: -->
297 <mml:mrow>
298 <mml:msup><mml:mn>2</mml:mn>
299 <mml:mfenced open="" close="">
300 <mml:mrow>
301 <mml:mi mathvariant="italic">k</mml:mi>
302 <mml:mo>-</mml:mo>
303 <mml:mn>1</mml:mn>
304 </mml:mrow>
305 </mml:mfenced>
306 </mml:msup>
307 <mml:mo>&times;</mml:mo>
308 <mml:mn>1</mml:mn>
309 </mml:mrow>
310 </mml:math></inlineequation>
311 until the final mipmap,
312 which has dimension
313 <inlineequation><mml:math>
314 <!-- eqn: 1 times 1: -->
315 <mml:mrow>
316 <mml:mn>1</mml:mn>
317 <mml:mo>&times;</mml:mo>
318 <mml:mn>1</mml:mn>
319 </mml:mrow>
320 </mml:math></inlineequation>.
321 To define the mipmaps, call <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>,
322 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>,
323 <citerefentry><refentrytitle>glCopyTexImage1D</refentrytitle></citerefentry>, or <citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>
324 with the <emphasis>level</emphasis> argument indicating the order of the mipmaps.
325 Level 0 is the original texture;
326 level
327 <inlineequation><mml:math>
328 <!-- eqn: max ( n, m ): -->
329 <mml:mrow>
330 <mml:mi mathvariant="italic">max</mml:mi>
331 <mml:mo>&af;</mml:mo>
332 <mml:mfenced open="(" close=")">
333 <mml:mi mathvariant="italic">n</mml:mi>
334 <mml:mi mathvariant="italic">m</mml:mi>
335 </mml:mfenced>
336 </mml:mrow>
337 </mml:math></inlineequation>
338 is the final
339 <inlineequation><mml:math>
340 <!-- eqn: 1 times 1: -->
341 <mml:mrow>
342 <mml:mn>1</mml:mn>
343 <mml:mo>&times;</mml:mo>
344 <mml:mn>1</mml:mn>
345 </mml:mrow>
346 </mml:math></inlineequation>
347 mipmap.
348 </para>
349 <para>
350 <parameter>params</parameter> supplies a function for minifying the texture as one of the
351 following:
352 <variablelist>
353 <varlistentry>
354 <term><constant>GL_NEAREST</constant></term>
355 <listitem>
356 <para>
357 Returns the value of the texture element that is nearest
358 (in Manhattan distance)
359 to the center of the pixel being textured.
360 </para>
361 </listitem>
362 </varlistentry>
363 <varlistentry>
364 <term><constant>GL_LINEAR</constant></term>
365 <listitem>
366 <para>
367 Returns the weighted average of the four texture elements
368 that are closest to the center of the pixel being textured.
369 These can include border texture elements,
370 depending on the values of <constant>GL_TEXTURE_WRAP_S</constant> and <constant>GL_TEXTURE_WRAP_T</constant>,
371 and on the exact mapping.
372 </para>
373 </listitem>
374 </varlistentry>
375 <varlistentry>
376 <term><constant>GL_NEAREST_MIPMAP_NEAREST</constant></term>
377 <listitem>
378 <para>
379 Chooses the mipmap that most closely matches the size of the pixel
380 being textured and uses the <constant>GL_NEAREST</constant> criterion
381 (the texture element nearest to the center of the pixel)
382 to produce a texture value.
383 </para>
384 </listitem>
385 </varlistentry>
386 <varlistentry>
387 <term><constant>GL_LINEAR_MIPMAP_NEAREST</constant></term>
388 <listitem>
389 <para>
390 Chooses the mipmap that most closely matches the size of the pixel
391 being textured and uses the <constant>GL_LINEAR</constant> criterion
392 (a weighted average of the four texture elements that are closest
393 to the center of the pixel)
394 to produce a texture value.
395 </para>
396 </listitem>
397 </varlistentry>
398 <varlistentry>
399 <term><constant>GL_NEAREST_MIPMAP_LINEAR</constant></term>
400 <listitem>
401 <para>
402 Chooses the two mipmaps that most closely match the size of the pixel
403 being textured and uses the <constant>GL_NEAREST</constant> criterion
404 (the texture element nearest to the center of the pixel)
405 to produce a texture value from each mipmap.
406 The final texture value is a weighted average of those two values.
407 </para>
408 </listitem>
409 </varlistentry>
410 <varlistentry>
411 <term><constant>GL_LINEAR_MIPMAP_LINEAR</constant></term>
412 <listitem>
413 <para>
414 Chooses the two mipmaps that most closely match the size of the pixel
415 being textured and uses the <constant>GL_LINEAR</constant> criterion
416 (a weighted average of the four texture elements that are closest
417 to the center of the pixel)
418 to produce a texture value from each mipmap.
419 The final texture value is a weighted average of those two values.
420 </para>
421 </listitem>
422 </varlistentry>
423 </variablelist>
424 </para>
425 <para>
426 As more texture elements are sampled in the minification process,
427 fewer aliasing artifacts will be apparent.
428 While the <constant>GL_NEAREST</constant> and <constant>GL_LINEAR</constant> minification functions can be
429 faster than the other four,
430 they sample only one or four texture elements to determine the texture value
431 of the pixel being rendered and can produce moire patterns
432 or ragged transitions.
433 The initial value of <constant>GL_TEXTURE_MIN_FILTER</constant> is
434 <constant>GL_NEAREST_MIPMAP_LINEAR</constant>.
435 </para>
436 </listitem>
437 </varlistentry>
438 <varlistentry>
439 <term><constant>GL_TEXTURE_MAG_FILTER</constant></term>
440 <listitem>
441 <para>
442 The texture magnification function is used when the pixel being textured
443 maps to an area less than or equal to one texture element.
444 It sets the texture magnification function to either <constant>GL_NEAREST</constant>
445 or <constant>GL_LINEAR</constant> (see below). <constant>GL_NEAREST</constant> is generally faster
446 than <constant>GL_LINEAR</constant>,
447 but it can produce textured images with sharper edges
448 because the transition between texture elements is not as smooth.
449 The initial value of <constant>GL_TEXTURE_MAG_FILTER</constant> is <constant>GL_LINEAR</constant>.
450 <variablelist>
451 <varlistentry>
452 <term><constant>GL_NEAREST</constant></term>
453 <listitem>
454 <para>
455 Returns the value of the texture element that is nearest
456 (in Manhattan distance)
457 to the center of the pixel being textured.
458 </para>
459 </listitem>
460 </varlistentry>
461 <varlistentry>
462 <term><constant>GL_LINEAR</constant></term>
463 <listitem>
464 <para>
465 Returns the weighted average of the four texture elements
466 that are closest to the center of the pixel being textured.
467 These can include border texture elements,
468 depending on the values of <constant>GL_TEXTURE_WRAP_S</constant> and <constant>GL_TEXTURE_WRAP_T</constant>,
469 and on the exact mapping.
470 </para>
471 </listitem>
472 </varlistentry>
473 </variablelist>
474 <para>
475 </para>
476 </para>
477 </listitem>
478 </varlistentry>
479 </variablelist>
480 <para>
481 </para>
482 <variablelist>
483 <varlistentry>
484 <term><constant>GL_TEXTURE_MIN_LOD</constant></term>
485 <listitem>
486 <para>
487 Sets the minimum level-of-detail parameter. This floating-point value
488 limits the selection of highest resolution mipmap (lowest mipmap
489 level). The initial value is -1000.
490 </para>
491 </listitem>
492 </varlistentry>
493 </variablelist>
494 <para>
495 </para>
496 <variablelist>
497 <varlistentry>
498 <term><constant>GL_TEXTURE_MAX_LOD</constant></term>
499 <listitem>
500 <para>
501 Sets the maximum level-of-detail parameter. This floating-point value
502 limits the selection of the lowest resolution mipmap (highest mipmap
503 level). The initial value is 1000.
504 </para>
505 </listitem>
506 </varlistentry>
507 </variablelist>
508 <para>
509 </para>
510 <variablelist>
511 <varlistentry>
512 <term><constant>GL_TEXTURE_WRAP_S</constant></term>
513 <listitem>
514 <para>
515 Sets the wrap parameter for texture coordinate
516 <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation>
517 to either <constant>GL_CLAMP_TO_EDGE</constant>, <constant>GL_MIRRORED_REPEAT</constant>, or
518 <constant>GL_REPEAT</constant>. <constant>GL_CLAMP_TO_BORDER</constant> causes the
519 <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation>
520 coordinate to be clamped to the range
521 <inlineequation><mml:math>
522 <!-- eqn: left [ {-1 over 2N}, 1 + {1 over 2N} right ]: -->
523 <mml:mfenced open="[" close="]">
524 <mml:mfenced open="" close="">
525 <mml:mrow>
526 <mml:mfrac>
527 <mml:mn>-1</mml:mn>
528 <mml:mn>2<mml:mi mathvariant="italic">N</mml:mi></mml:mn>
529 </mml:mfrac>
530 </mml:mrow>
531 </mml:mfenced>
532 <mml:mrow>
533 <mml:mn>1</mml:mn>
534 <mml:mo>+</mml:mo>
535 <mml:mfenced open="" close="">
536 <mml:mrow>
537 <mml:mfrac>
538 <mml:mn>1</mml:mn>
539 <mml:mn>2<mml:mi mathvariant="italic">N</mml:mi></mml:mn>
540 </mml:mfrac>
541 </mml:mrow>
542 </mml:mfenced>
543 </mml:mrow>
544 </mml:mfenced>
545 </mml:math></inlineequation>,
546 where
547 <inlineequation><mml:math><mml:mi mathvariant="italic">N</mml:mi></mml:math></inlineequation>
548 is the size of the texture in the direction of
549 clamping.<constant>GL_CLAMP_TO_EDGE</constant> causes
550 <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation>
551 coordinates to be clamped to the
552 range
553 <inlineequation><mml:math>
554 <!-- eqn: left [ {1 over 2N}, 1 - {1 over 2N} right ]: -->
555 <mml:mfenced open="[" close="]">
556 <mml:mfenced open="" close="">
557 <mml:mrow>
558 <mml:mfrac>
559 <mml:mn>1</mml:mn>
560 <mml:mn>2<mml:mi mathvariant="italic">N</mml:mi></mml:mn>
561 </mml:mfrac>
562 </mml:mrow>
563 </mml:mfenced>
564 <mml:mrow>
565 <mml:mn>1</mml:mn>
566 <mml:mo>-</mml:mo>
567 <mml:mfenced open="" close="">
568 <mml:mrow>
569 <mml:mfrac>
570 <mml:mn>1</mml:mn>
571 <mml:mn>2<mml:mi mathvariant="italic">N</mml:mi></mml:mn>
572 </mml:mfrac>
573 </mml:mrow>
574 </mml:mfenced>
575 </mml:mrow>
576 </mml:mfenced>
577 </mml:math></inlineequation>,
578 where
579 <inlineequation><mml:math><mml:mi mathvariant="italic">N</mml:mi></mml:math></inlineequation>
580 is the size
581 of the texture in the direction of clamping. <constant>GL_REPEAT</constant> causes the
582 integer part of the
583 <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation>
584 coordinate to be ignored; the GL uses only the
585 fractional part, thereby creating a repeating pattern.
586 <constant>GL_MIRRORED_REPEAT</constant> causes the
587 <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation>
588 coordinate to be set to the
589 fractional part of the texture coordinate if the integer part of
590 <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation>
591 is
592 even; if the integer part of
593 <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation>
594 is odd, then the
595 <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation>
596 texture coordinate is
597 set to
598 <inlineequation><mml:math>
599 <!-- eqn: 1 - frac(s): -->
600 <mml:mrow>
601 <mml:mn>1</mml:mn>
602 <mml:mo>-</mml:mo>
603 <mml:mrow>
604 <mml:mi mathvariant="italic">frac</mml:mi>
605 <mml:mo>&af;</mml:mo>
606 <mml:mfenced open="(" close=")">
607 <mml:mi mathvariant="italic">s</mml:mi>
608 </mml:mfenced>
609 </mml:mrow>
610 </mml:mrow>
611 </mml:math></inlineequation>,
612 where
613 <inlineequation><mml:math>
614 <!-- eqn: frac(s): -->
615 <mml:mrow>
616 <mml:mi mathvariant="italic">frac</mml:mi>
617 <mml:mo>&af;</mml:mo>
618 <mml:mfenced open="(" close=")">
619 <mml:mi mathvariant="italic">s</mml:mi>
620 </mml:mfenced>
621 </mml:mrow>
622 </mml:math></inlineequation>
623 represents the fractional part of
624 <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation>.
625 Initially, <constant>GL_TEXTURE_WRAP_S</constant> is set to <constant>GL_REPEAT</constant>.
626 </para>
627 </listitem>
628 </varlistentry>
629 </variablelist>
630 <para>
631 </para>
632 <variablelist>
633 <varlistentry>
634 <term><constant>GL_TEXTURE_WRAP_T</constant></term>
635 <listitem>
636 <para>
637 Sets the wrap parameter for texture coordinate
638 <inlineequation><mml:math><mml:mi mathvariant="italic">t</mml:mi></mml:math></inlineequation>
639 to either <constant>GL_CLAMP_TO_EDGE</constant>, <constant>GL_MIRRORED_REPEAT</constant>, or
640 <constant>GL_REPEAT</constant>. See the discussion under <constant>GL_TEXTURE_WRAP_S</constant>.
641 Initially, <constant>GL_TEXTURE_WRAP_T</constant> is set to <constant>GL_REPEAT</constant>.
642 </para>
643 </listitem>
644 </varlistentry>
645 <varlistentry>
646 <term><constant>GL_TEXTURE_WRAP_R</constant></term>
647 <listitem>
648 <para>
649 Sets the wrap parameter for texture coordinate
650 <inlineequation><mml:math><mml:mi mathvariant="italic">r</mml:mi></mml:math></inlineequation>
651 to either <constant>GL_CLAMP_TO_EDGE</constant>, <constant>GL_MIRRORED_REPEAT</constant>, or
652 <constant>GL_REPEAT</constant>. See the discussion under <constant>GL_TEXTURE_WRAP_S</constant>.
653 Initially, <constant>GL_TEXTURE_WRAP_R</constant> is set to <constant>GL_REPEAT</constant>.
654 </para>
655 </listitem>
656 </varlistentry>
657 <varlistentry>
658 <term><constant>GL_TEXTURE_BORDER_COLOR</constant></term>
659 <listitem>
660 <para>
661 The data in <parameter>params</parameter> specifies four values that define the border values that
662 should be used for border texels. If a texel is sampled from the border of the texture, the
663 values of <constant>GL_TEXTURE_BORDER_COLOR</constant> are interpreted as an RGBA color to match the
664 texture's internal format and substituted for the non-existent texel data. If the texture contains depth
665 components, the first component of <constant>GL_TEXTURE_BORDER_COLOR</constant> is interpreted as a depth value.
666 The initial value is
667 <inlineequation><mml:math>
668 <mml:mrow>
669 <mml:mfenced open="(" close=")">
670 <mml:mrow>
671 <mml:mn>0.0</mml:mn>, <mml:mn>0.0</mml:mn>, <mml:mn>0.0</mml:mn>, <mml:mn>0.0</mml:mn>
672 </mml:mrow>
673 </mml:mfenced>
674 </mml:mrow>
675 </mml:math></inlineequation>.
676 </para>
677 </listitem>
678 </varlistentry>
679 <varlistentry>
680 <term><constant>GL_TEXTURE_COMPARE_MODE</constant></term>
681 <listitem>
682 <para>
683 Specifies the texture comparison mode for currently bound textures.
684 That is, a texture whose internal format is <constant>GL_DEPTH_COMPONENT_*</constant>; see
685 <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>)
686 Permissible values are:
687 <variablelist>
688 <varlistentry>
689 <term><constant>GL_COMPARE_REF_TO_TEXTURE</constant></term>
690 <listitem>
691 <para>
692 Specifies that the interpolated and clamped
693 <inlineequation><mml:math><mml:mi mathvariant="italic">r</mml:mi></mml:math></inlineequation>
694 texture coordinate should
695 be compared to the value in the currently bound texture. See the
696 discussion of <constant>GL_TEXTURE_COMPARE_FUNC</constant> for details of how the comparison
697 is evaluated. The result of the comparison is assigned to the red channel.
698 </para>
699 </listitem>
700 </varlistentry>
701 <varlistentry>
702 <term><constant>GL_NONE</constant></term>
703 <listitem>
704 <para>
705 Specifies that the red channel should be assigned the
706 appropriate value from the currently bound texture.
707 </para>
708 </listitem>
709 </varlistentry>
710 </variablelist>
711 </para>
712 </listitem>
713 </varlistentry>
714 <varlistentry>
715 <term><constant>GL_TEXTURE_COMPARE_FUNC</constant></term>
716 <listitem>
717 <para>
718 Specifies the comparison operator used when <constant>GL_TEXTURE_COMPARE_MODE</constant> is
719 set to <constant>GL_COMPARE_REF_TO_TEXTURE</constant>. Permissible values are:
720 <informaltable frame="topbot">
721 <tgroup cols="2" align="left">
722 <colspec/>
723 <colspec/>
724 <thead>
725 <row>
726 <entry rowsep="1" align="left"><emphasis role="bold">
727 Texture Comparison Function
728 </emphasis></entry>
729 <entry rowsep="1" align="left"><emphasis role="bold">
730 Computed result
731 </emphasis></entry>
732 </row>
733 </thead>
734 <tbody>
735 <row>
736 <entry align="left">
737 <constant>GL_LEQUAL</constant>
738 </entry>
739 <entry align="left">
740 <informalequation><mml:math>
741 <!-- eqn: result = left { cpile {1.0 above 0.0} lpile {r <= {D sub t} above r > {D sub t}}: -->
742 <mml:mrow>
743 <mml:mi mathvariant="italic">result</mml:mi>
744 <mml:mo>=</mml:mo>
745 <mml:mfenced open="{" close="">
746 <mml:mrow>
747 <mml:mtable>
748 <mml:mtr><mml:mtd>
749 <mml:mn>1.0</mml:mn>
750 </mml:mtd></mml:mtr>
751 <mml:mtr><mml:mtd>
752 <mml:mn>0.0</mml:mn>
753 </mml:mtd></mml:mtr>
754 </mml:mtable>
755 <mml:mo>&it;&nbsp;&nbsp;</mml:mo>
756 <mml:mtable>
757 <mml:mtr><mml:mtd>
758 <mml:mrow>
759 <mml:mi mathvariant="italic">r</mml:mi>
760 <mml:mo>&lt;=</mml:mo>
761 <mml:mfenced open="" close="">
762 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
763 <mml:mi mathvariant="italic">t</mml:mi>
764 </mml:msub>
765 </mml:mfenced>
766 </mml:mrow>
767 </mml:mtd></mml:mtr>
768 <mml:mtr><mml:mtd>
769 <mml:mrow>
770 <mml:mi mathvariant="italic">r</mml:mi>
771 <mml:mo>&gt;</mml:mo>
772 <mml:mfenced open="" close="">
773 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
774 <mml:mi mathvariant="italic">t</mml:mi>
775 </mml:msub>
776 </mml:mfenced>
777 </mml:mrow>
778 </mml:mtd></mml:mtr>
779 </mml:mtable>
780 </mml:mrow>
781 </mml:mfenced>
782 </mml:mrow>
783 </mml:math></informalequation>
784 </entry>
785 </row>
786 <row>
787 <entry align="left">
788 <constant>GL_GEQUAL</constant>
789 </entry>
790 <entry align="left">
791 <informalequation><mml:math>
792 <!-- eqn: result = left { cpile {1.0 above 0.0} lpile {r <= {D sub t} above r > {D sub t}}: -->
793 <mml:mrow>
794 <mml:mi mathvariant="italic">result</mml:mi>
795 <mml:mo>=</mml:mo>
796 <mml:mfenced open="{" close="">
797 <mml:mrow>
798 <mml:mtable>
799 <mml:mtr><mml:mtd>
800 <mml:mn>1.0</mml:mn>
801 </mml:mtd></mml:mtr>
802 <mml:mtr><mml:mtd>
803 <mml:mn>0.0</mml:mn>
804 </mml:mtd></mml:mtr>
805 </mml:mtable>
806 <mml:mo>&it;&nbsp;&nbsp;</mml:mo>
807 <mml:mtable>
808 <mml:mtr><mml:mtd>
809 <mml:mrow>
810 <mml:mi mathvariant="italic">r</mml:mi>
811 <mml:mo>&gt;=</mml:mo>
812 <mml:mfenced open="" close="">
813 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
814 <mml:mi mathvariant="italic">t</mml:mi>
815 </mml:msub>
816 </mml:mfenced>
817 </mml:mrow>
818 </mml:mtd></mml:mtr>
819 <mml:mtr><mml:mtd>
820 <mml:mrow>
821 <mml:mi mathvariant="italic">r</mml:mi>
822 <mml:mo>&lt;</mml:mo>
823 <mml:mfenced open="" close="">
824 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
825 <mml:mi mathvariant="italic">t</mml:mi>
826 </mml:msub>
827 </mml:mfenced>
828 </mml:mrow>
829 </mml:mtd></mml:mtr>
830 </mml:mtable>
831 </mml:mrow>
832 </mml:mfenced>
833 </mml:mrow>
834 </mml:math></informalequation>
835 </entry>
836 </row>
837 <row>
838 <entry align="left">
839 <constant>GL_LESS</constant>
840 </entry>
841 <entry align="left">
842 <informalequation><mml:math>
843 <!-- eqn: result = left { cpile {1.0 above 0.0} lpile {r <= {D sub t} above r > {D sub t}}: -->
844 <mml:mrow>
845 <mml:mi mathvariant="italic">result</mml:mi>
846 <mml:mo>=</mml:mo>
847 <mml:mfenced open="{" close="">
848 <mml:mrow>
849 <mml:mtable>
850 <mml:mtr><mml:mtd>
851 <mml:mn>1.0</mml:mn>
852 </mml:mtd></mml:mtr>
853 <mml:mtr><mml:mtd>
854 <mml:mn>0.0</mml:mn>
855 </mml:mtd></mml:mtr>
856 </mml:mtable>
857 <mml:mo>&it;&nbsp;&nbsp;</mml:mo>
858 <mml:mtable>
859 <mml:mtr><mml:mtd>
860 <mml:mrow>
861 <mml:mi mathvariant="italic">r</mml:mi>
862 <mml:mo>&lt;</mml:mo>
863 <mml:mfenced open="" close="">
864 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
865 <mml:mi mathvariant="italic">t</mml:mi>
866 </mml:msub>
867 </mml:mfenced>
868 </mml:mrow>
869 </mml:mtd></mml:mtr>
870 <mml:mtr><mml:mtd>
871 <mml:mrow>
872 <mml:mi mathvariant="italic">r</mml:mi>
873 <mml:mo>&gt;=</mml:mo>
874 <mml:mfenced open="" close="">
875 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
876 <mml:mi mathvariant="italic">t</mml:mi>
877 </mml:msub>
878 </mml:mfenced>
879 </mml:mrow>
880 </mml:mtd></mml:mtr>
881 </mml:mtable>
882 </mml:mrow>
883 </mml:mfenced>
884 </mml:mrow>
885 </mml:math></informalequation>
886 </entry>
887 </row>
888 <row>
889 <entry align="left">
890 <constant>GL_GREATER</constant>
891 </entry>
892 <entry align="left">
893 <informalequation><mml:math>
894 <!-- eqn: result = left { cpile {1.0 above 0.0} lpile {r <= {D sub t} above r > {D sub t}}: -->
895 <mml:mrow>
896 <mml:mi mathvariant="italic">result</mml:mi>
897 <mml:mo>=</mml:mo>
898 <mml:mfenced open="{" close="">
899 <mml:mrow>
900 <mml:mtable>
901 <mml:mtr><mml:mtd>
902 <mml:mn>1.0</mml:mn>
903 </mml:mtd></mml:mtr>
904 <mml:mtr><mml:mtd>
905 <mml:mn>0.0</mml:mn>
906 </mml:mtd></mml:mtr>
907 </mml:mtable>
908 <mml:mo>&it;&nbsp;&nbsp;</mml:mo>
909 <mml:mtable>
910 <mml:mtr><mml:mtd>
911 <mml:mrow>
912 <mml:mi mathvariant="italic">r</mml:mi>
913 <mml:mo>&gt;</mml:mo>
914 <mml:mfenced open="" close="">
915 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
916 <mml:mi mathvariant="italic">t</mml:mi>
917 </mml:msub>
918 </mml:mfenced>
919 </mml:mrow>
920 </mml:mtd></mml:mtr>
921 <mml:mtr><mml:mtd>
922 <mml:mrow>
923 <mml:mi mathvariant="italic">r</mml:mi>
924 <mml:mo>&lt;=</mml:mo>
925 <mml:mfenced open="" close="">
926 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
927 <mml:mi mathvariant="italic">t</mml:mi>
928 </mml:msub>
929 </mml:mfenced>
930 </mml:mrow>
931 </mml:mtd></mml:mtr>
932 </mml:mtable>
933 </mml:mrow>
934 </mml:mfenced>
935 </mml:mrow>
936 </mml:math></informalequation>
937 </entry>
938 </row>
939 <row>
940 <entry align="left">
941 <constant>GL_EQUAL</constant>
942 </entry>
943 <entry align="left">
944 <informalequation><mml:math>
945 <!-- eqn: result = left { cpile {1.0 above 0.0} lpile {r <= {D sub t} above r > {D sub t}}: -->
946 <mml:mrow>
947 <mml:mi mathvariant="italic">result</mml:mi>
948 <mml:mo>=</mml:mo>
949 <mml:mfenced open="{" close="">
950 <mml:mrow>
951 <mml:mtable>
952 <mml:mtr><mml:mtd>
953 <mml:mn>1.0</mml:mn>
954 </mml:mtd></mml:mtr>
955 <mml:mtr><mml:mtd>
956 <mml:mn>0.0</mml:mn>
957 </mml:mtd></mml:mtr>
958 </mml:mtable>
959 <mml:mo>&it;&nbsp;&nbsp;</mml:mo>
960 <mml:mtable>
961 <mml:mtr><mml:mtd>
962 <mml:mrow>
963 <mml:mi mathvariant="italic">r</mml:mi>
964 <mml:mo>=</mml:mo>
965 <mml:mfenced open="" close="">
966 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
967 <mml:mi mathvariant="italic">t</mml:mi>
968 </mml:msub>
969 </mml:mfenced>
970 </mml:mrow>
971 </mml:mtd></mml:mtr>
972 <mml:mtr><mml:mtd>
973 <mml:mrow>
974 <mml:mi mathvariant="italic">r</mml:mi>
975 <mml:mo>&ne;</mml:mo>
976 <mml:mfenced open="" close="">
977 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
978 <mml:mi mathvariant="italic">t</mml:mi>
979 </mml:msub>
980 </mml:mfenced>
981 </mml:mrow>
982 </mml:mtd></mml:mtr>
983 </mml:mtable>
984 </mml:mrow>
985 </mml:mfenced>
986 </mml:mrow>
987 </mml:math></informalequation>
988 </entry>
989 </row>
990 <row>
991 <entry align="left">
992 <constant>GL_NOTEQUAL</constant>
993 </entry>
994 <entry align="left">
995 <informalequation><mml:math>
996 <!-- eqn: result = left { cpile {1.0 above 0.0} lpile {r <= {D sub t} above r > {D sub t}}: -->
997 <mml:mrow>
998 <mml:mi mathvariant="italic">result</mml:mi>
999 <mml:mo>=</mml:mo>
1000 <mml:mfenced open="{" close="">
1001 <mml:mrow>
1002 <mml:mtable>
1003 <mml:mtr><mml:mtd>
1004 <mml:mn>1.0</mml:mn>
1005 </mml:mtd></mml:mtr>
1006 <mml:mtr><mml:mtd>
1007 <mml:mn>0.0</mml:mn>
1008 </mml:mtd></mml:mtr>
1009 </mml:mtable>
1010 <mml:mo>&it;&nbsp;&nbsp;</mml:mo>
1011 <mml:mtable>
1012 <mml:mtr><mml:mtd>
1013 <mml:mrow>
1014 <mml:mi mathvariant="italic">r</mml:mi>
1015 <mml:mo>&ne;</mml:mo>
1016 <mml:mfenced open="" close="">
1017 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
1018 <mml:mi mathvariant="italic">t</mml:mi>
1019 </mml:msub>
1020 </mml:mfenced>
1021 </mml:mrow>
1022 </mml:mtd></mml:mtr>
1023 <mml:mtr><mml:mtd>
1024 <mml:mrow>
1025 <mml:mi mathvariant="italic">r</mml:mi>
1026 <mml:mo>=</mml:mo>
1027 <mml:mfenced open="" close="">
1028 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
1029 <mml:mi mathvariant="italic">t</mml:mi>
1030 </mml:msub>
1031 </mml:mfenced>
1032 </mml:mrow>
1033 </mml:mtd></mml:mtr>
1034 </mml:mtable>
1035 </mml:mrow>
1036 </mml:mfenced>
1037 </mml:mrow>
1038 </mml:math></informalequation>
1039 </entry>
1040 </row>
1041 <row>
1042 <entry align="left">
1043 <constant>GL_ALWAYS</constant>
1044 </entry>
1045 <entry align="left">
1046 <informalequation>
1047 <mml:math>
1048 <mml:mrow>
1049 <mml:mi mathvariant="italic">result</mml:mi>
1050 <mml:mo>=</mml:mo>
1051 <mml:mi>1.0</mml:mi>
1052 </mml:mrow>
1053 </mml:math>
1054 </informalequation>
1055 </entry>
1056 </row>
1057 <row>
1058 <entry align="left">
1059 <constant>GL_NEVER</constant>
1060 </entry>
1061 <entry align="left">
1062 <informalequation>
1063 <mml:math>
1064 <mml:mrow>
1065 <mml:mi mathvariant="italic">result</mml:mi>
1066 <mml:mo>=</mml:mo>
1067 <mml:mi>0.0</mml:mi>
1068 </mml:mrow>
1069 </mml:math>
1070 </informalequation>
1071 </entry>
1072 </row>
1073 </tbody>
1074 </tgroup>
1075 </informaltable>
1076 where <inlineequation><mml:math><mml:mi mathvariant="italic">r</mml:mi></mml:math></inlineequation>
1077 is the current interpolated texture coordinate, and
1078 <inlineequation><mml:math>
1079 <!-- eqn: D sub t: -->
1080 <mml:msub><mml:mi mathvariant="italic">D</mml:mi>
1081 <mml:mi mathvariant="italic">t</mml:mi>
1082 </mml:msub>
1083 </mml:math></inlineequation>
1084 is the texture value sampled from the currently bound texture.
1085 <inlineequation><mml:math><mml:mi mathvariant="italic">result</mml:mi></mml:math></inlineequation>
1086 is assigned to
1087 <inlineequation><mml:math>
1088 <!-- eqn: R sub t: -->
1089 <mml:msub><mml:mi mathvariant="italic">R</mml:mi>
1090 <mml:mi mathvariant="italic">t</mml:mi>
1091 </mml:msub>
1092 </mml:math></inlineequation>.
1093 </para>
1094 </listitem>
1095 </varlistentry>
1096 </variablelist>
1097 </refsect1>
1098 <refsect1 id="notes"><title>Notes</title>
1099 <para>
1100 <function>glSamplerParameter</function> is available only if the GL version is 3.3 or higher.
1101 </para>
1102 <para>
1103 If a sampler object is bound to a texture unit and that unit is used to sample from a texture, the parameters in the sampler
1104 are used to sample from the texture, rather than the equivalent parameters in the texture object bound to that unit. This
1105 introduces the possibility of sampling from the same texture object with different sets of sampler state, which may lead to
1106 a condition where a texture is <emphasis>incomplete</emphasis> with respect to one sampler object and not with respect to
1107 another. Thus, completeness can be considered a function of a sampler object and a texture object bound to a single
1108 texture unit, rather than a property of the texture object itself.
1109 </para>
1110 </refsect1>
1111 <refsect1 id="errors"><title>Errors</title>
1112 <para>
1113 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>sampler</parameter> is not the name of a sampler object previously
1114 returned from a call to <citerefentry><refentrytitle>glGenSamplers</refentrytitle></citerefentry>.
1115 </para>
1116 <para>
1117 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>params</parameter> should have a defined
1118 constant value (based on the value of <parameter>pname</parameter>) and does not.
1119 </para>
1120 </refsect1>
1121 <refsect1 id="associatedgets"><title>Associated Gets</title>
1122 <para>
1123 <citerefentry><refentrytitle>glGetSamplerParameter</refentrytitle></citerefentry>
1124 </para>
1125 </refsect1>
1126 <refsect1 id="seealso"><title>See Also</title>
1127 <para>
1128 <citerefentry><refentrytitle>glGenSamplers</refentrytitle></citerefentry>,
1129 <citerefentry><refentrytitle>glBindSampler</refentrytitle></citerefentry>,
1130 <citerefentry><refentrytitle>glDeleteSamplers</refentrytitle></citerefentry>,
1131 <citerefentry><refentrytitle>glIsSampler</refentrytitle></citerefentry>,
1132 <citerefentry><refentrytitle>glBindTexture</refentrytitle></citerefentry>,
1133 <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry>
1134 </para>
1135 </refsect1>
1136 <refsect1 id="Copyright"><title>Copyright</title>
1137 <para>
1138 Copyright <trademark class="copyright"></trademark> 2010 Khronos Group.
1139 This material may be distributed subject to the terms and conditions set forth in
1140 the Open Publication License, v 1.0, 8 June 1999.
1141 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
1142 </para>
1143 </refsect1>
1144 </refentry>