1GLTEXPARAMETER(3G) GLTEXPARAMETER(3G)
2
3
4
6 glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv -
7 set texture parameters
8
9
11 void glTexParameterf( GLenum target,
12 GLenum pname,
13 GLfloat param )
14 void glTexParameteri( GLenum target,
15 GLenum pname,
16 GLint param )
17
18
20 target Specifies the target texture, which must be either
21 GL_TEXTURE_1D, GL_TEXTURE_2D, or GL_TEXTURE_3D.
22
23 pname Specifies the symbolic name of a single-valued texture parame‐
24 ter. pname can be one of the following: GL_TEXTURE_MIN_FILTER,
25 GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_LOD, GL_TEXTURE_MAX_LOD,
26 GL_TEXTURE_BASE_LEVEL, GL_TEXTURE_MAX_LEVEL, GL_TEXTURE_WRAP_S,
27 GL_TEXTURE_WRAP_T, GL_TEXTURE_WRAP_R, or GL_TEXTURE_PRIORITY.
28
29 param Specifies the value of pname.
30
32 void glTexParameterfv( GLenum target,
33 GLenum pname,
34 const GLfloat *params )
35 void glTexParameteriv( GLenum target,
36 GLenum pname,
37 const GLint *params )
38
39
41 target Specifies the target texture, which must be either
42 GL_TEXTURE_1D, GL_TEXTURE_2D or GL_TEXTURE_3D.
43
44 pname Specifies the symbolic name of a texture parameter. pname can
45 be one of the following: GL_TEXTURE_MIN_FILTER,
46 GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_LOD, GL_TEXTURE_MAX_LOD,
47 GL_TEXTURE_BASE_LEVEL, GL_TEXTURE_MAX_LEVEL, GL_TEXTURE_WRAP_S,
48 GL_TEXTURE_WRAP_T, GL_TEXTURE_WRAP_R, GL_TEXTURE_BORDER_COLOR,
49 or GL_TEXTURE_PRIORITY.
50
51 params Specifies a pointer to an array where the value or values of
52 pname are stored.
53
55 Texture mapping is a technique that applies an image onto an object's
56 surface as if the image were a decal or cellophane shrink-wrap. The
57 image is created in texture space, with an (s, t) coordinate system. A
58 texture is a one- or two-dimensional image and a set of parameters that
59 determine how samples are derived from the image.
60
61 glTexParameter assigns the value or values in params to the texture
62 parameter specified as pname. target defines the target texture,
63 either GL_TEXTURE_1D, GL_TEXTURE_2D, or GL_TEXTURE_3D. The following
64 symbols are accepted in pname:
65
66 GL_TEXTURE_MIN_FILTER
67 The texture minifying function is used whenever the pixel
68 being textured maps to an area greater than one texture ele‐
69 ment. There are six defined minifying functions. Two of
70 them use the nearest one or nearest four texture elements to
71 compute the texture value. The other four use mipmaps.
72
73 A mipmap is an ordered set of arrays representing the same
74 image at progressively lower resolutions. If the texture has
75 dimensions 2n×2m, there are max(n,m)+1 mipmaps. The first
76 mipmap is the original texture, with dimensions 2n×2m. Each
77 subsequent mipmap has dimensions 2k−1×2l−1, where 2k×2l are
78 the dimensions of the previous mipmap, until either k=0 or
79 l=0. At that point, subsequent mipmaps have dimension 1×2l−1
80 or 2k−1×1 until the final mipmap, which has dimension 1×1.
81 To define the mipmaps, call glTexImage1D, glTexImage2D,
82 glTexImage3D, glCopyTexImage1D, or glCopyTexImage2D with the
83 level argument indicating the order of the mipmaps. Level 0
84 is the original texture; level max(n,m) is the final 1×1
85 mipmap.
86
87 params supplies a function for minifying the texture as one
88 of the following:
89
90 GL_NEAREST
91 Returns the value of the texture element that is
92 nearest (in Manhattan distance) to the center of
93 the pixel being textured.
94
95 GL_LINEAR Returns the weighted average of the four texture
96 elements that are closest to the center of the
97 pixel being textured. These can include border
98 texture elements, depending on the values of
99 GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T, and on the
100 exact mapping.
101
102 GL_NEAREST_MIPMAP_NEAREST
103 Chooses the mipmap that most closely matches the
104 size of the pixel being textured and uses the
105 GL_NEAREST criterion (the texture element nearest
106 to the center of the pixel) to produce a texture
107 value.
108
109 GL_LINEAR_MIPMAP_NEAREST
110 Chooses the mipmap that most closely matches the
111 size of the pixel being textured and uses the
112 GL_LINEAR criterion (a weighted average of the four
113 texture elements that are closest to the center of
114 the pixel) to produce a texture value.
115
116 GL_NEAREST_MIPMAP_LINEAR
117 Chooses the two mipmaps that most closely match the
118 size of the pixel being textured and uses the
119 GL_NEAREST criterion (the texture element nearest
120 to the center of the pixel) to produce a texture
121 value from each mipmap. The final texture value is
122 a weighted average of those two values.
123
124 GL_LINEAR_MIPMAP_LINEAR
125 Chooses the two mipmaps that most closely match the
126 size of the pixel being textured and uses the
127 GL_LINEAR criterion (a weighted average of the four
128 texture elements that are closest to the center of
129 the pixel) to produce a texture value from each
130 mipmap. The final texture value is a weighted
131 average of those two values.
132
133 As more texture elements are sampled in the minification
134 process, fewer aliasing artifacts will be apparent. While
135 the GL_NEAREST and GL_LINEAR minification functions can be
136 faster than the other four, they sample only one or four tex‐
137 ture elements to determine the texture value of the pixel
138 being rendered and can produce moire patterns or ragged tran‐
139 sitions. The initial value of GL_TEXTURE_MIN_FILTER is
140 GL_NEAREST_MIPMAP_LINEAR.
141
142 GL_TEXTURE_MAG_FILTER
143 The texture magnification function is used when the pixel
144 being textured maps to an area less than or equal to one tex‐
145 ture element. It sets the texture magnification function to
146 either GL_NEAREST or GL_LINEAR (see below). GL_NEAREST is
147 generally faster than GL_LINEAR, but it can produce textured
148 images with sharper edges because the transition between tex‐
149 ture elements is not as smooth. The initial value of
150 GL_TEXTURE_MAG_FILTER is GL_LINEAR.
151
152 GL_NEAREST
153 Returns the value of the texture element that is
154 nearest (in Manhattan distance) to the center of
155 the pixel being textured.
156
157 GL_LINEAR Returns the weighted average of the four texture
158 elements that are closest to the center of the
159 pixel being textured. These can include border
160 texture elements, depending on the values of
161 GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T, and on the
162 exact mapping.
163
164 GL_TEXTURE_MIN_LOD
165 Sets the minimum level-of-detail parameter. This floating-
166 point value limits the selection of highest resolution mipmap
167 (lowest mipmap level). The initial value is -1000.
168
169 GL_TEXTURE_MAX_LOD
170 Sets the maximum level-of-detail parameter. This floating-
171 point value limits the selection of the lowest resolution
172 mipmap (highest mipmap level). The initial value is 1000.
173
174 GL_TEXTURE_BASE_LEVEL
175 Specifies the index of the lowest defined mipmap level. This
176 is an integer value. The initial value is 0.
177
178 GL_TEXTURE_MAX_LEVEL
179 Sets the index of the highest defined mipmap level. This is
180 an integer value. The initial value is 1000.
181
182 GL_TEXTURE_WRAP_S
183 Sets the wrap parameter for texture coordinate s to either
184 GL_CLAMP, GL_CLAMP_TO_EDGE, or GL_REPEAT. GL_CLAMP causes s
185 coordinates to be clamped to the range [0,1] and is useful
186 for preventing wrapping artifacts when mapping a single image
187 onto an object. GL_CLAMP_TO_EDGE causes s coordinates to be
188 clamped to the range ⎡⎣2_1N_,1−2_1N_⎤⎦, where N is the size of the
189 texture in the direction of clamping. GL_REPEAT causes the
190 integer part of the s coordinate to be ignored; the GL uses
191 only the fractional part, thereby creating a repeating pat‐
192 tern. Border texture elements are accessed only if wrapping
193 is set to GL_CLAMP. Initially, GL_TEXTURE_WRAP_S is set to
194 GL_REPEAT.
195
196 GL_TEXTURE_WRAP_T
197 Sets the wrap parameter for texture coordinate t to either
198 GL_CLAMP, GL_CLAMP_TO_EDGE, or GL_REPEAT. See the discussion
199 under GL_TEXTURE_WRAP_S. Initially, GL_TEXTURE_WRAP_T is set
200 to GL_REPEAT.
201
202 GL_TEXTURE_WRAP_R
203 Sets the wrap parameter for texture coordinate r to either
204 GL_CLAMP, GL_CLAMP_TO_EDGE, or GL_REPEAT. See the discussion
205 under GL_TEXTURE_WRAP_S. Initially, GL_TEXTURE_WRAP_R is set
206 to GL_REPEAT.
207
208 GL_TEXTURE_BORDER_COLOR
209 Sets a border color. params contains four values that com‐
210 prise the RGBA color of the texture border. Integer color
211 components are interpreted linearly such that the most posi‐
212 tive integer maps to 1.0, and the most negative integer maps
213 to -1.0. The values are clamped to the range [0,1] when they
214 are specified. Initially, the border color is (0, 0, 0, 0).
215
216 GL_TEXTURE_PRIORITY
217 Specifies the texture residence priority of the currently
218 bound texture. Permissible values are in the range [0, 1].
219 See glPrioritizeTextures and glBindTexture for more informa‐
220 tion.
221
223 GL_TEXTURE_3D, GL_TEXTURE_MIN_LOD, GL_TEXTURE_MAX_LOD,
224 GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL are only available if
225 the GL version is 1.2 or greater.
226
227 Suppose that a program has enabled texturing (by calling glEnable with
228 argument GL_TEXTURE_1D, GL_TEXTURE_2D, or GL_TEXTURE_3D) and has set
229 GL_TEXTURE_MIN_FILTER to one of the functions that requires a mipmap.
230 If either the dimensions of the texture images currently defined (with
231 previous calls to glTexImage1D, glTexImage2D, glTexImage3D,
232 glCopyTexImage1D, or glCopyTexImage2D) do not follow the proper
233 sequence for mipmaps (described above), or there are fewer texture
234 images defined than are needed, or the set of texture images have dif‐
235 fering numbers of texture components, then it is as if texture mapping
236 were disabled.
237
238 Linear filtering accesses the four nearest texture elements only in 2D
239 textures. In 1D textures, linear filtering accesses the two nearest
240 texture elements.
241
242 When the GL_ARB_multitexture extension is supported, glTexParameter
243 specifies the texture parameters for the active texture unit, specified
244 by calling glActiveTextureARB.
245
247 GL_INVALID_ENUM is generated if target or pname is not one of the
248 accepted defined values.
249
250 GL_INVALID_ENUM is generated if params should have a defined constant
251 value (based on the value of pname) and does not.
252
253 GL_INVALID_OPERATION is generated if glTexParameter is executed between
254 the execution of glBegin and the corresponding execution of glEnd.
255
257 glGetTexParameter
258 glGetTexLevelParameter
259
261 glActiveTextureARB(3G), glBindTexture(3G), glCopyPixels(3G),
262 glCopyTexImage1D(3G), glCopyTexImage2D(3G), glCopyTexSubImage1D(3G),
263 glCopyTexSubImage2D(3G), glCopyTexSubImage3D(3G), glDrawPixels(3G),
264 glPixelStore(3G), glPixelTransfer(3G), glPrioritizeTextures(3G),
265 glTexEnv(3G), glTexGen(3G), glTexImage1D(3G), glTexImage2D(3G),
266 glTexImage3D(3G), glTexSubImage1D(3G), glTexSubImage2D(3G),
267 glTexSubImage3D(3G)
268
269
270
271
272
273 GLTEXPARAMETER(3G)