1991-2006Silicon Graphics, Inc.glTexParameter3GglTexParameterset texture parametersC Specificationvoid glTexParameterfGLenum targetGLenum pnameGLfloat paramvoid glTexParameteriGLenum targetGLenum pnameGLint paramParameterstarget
Specifies the target texture of the active texture unit,
which must be either GL_TEXTURE_2D or
GL_TEXTURE_CUBE_MAP.
pname
Specifies the symbolic name of a single-valued texture parameter.
pname can be one of the following:
GL_TEXTURE_MIN_FILTER,
GL_TEXTURE_MAG_FILTER,
GL_TEXTURE_WRAP_S, or
GL_TEXTURE_WRAP_T.
param
Specifies the value of pname.
C Specificationvoid glTexParameterfvGLenum targetGLenum pnameconst GLfloat * paramsvoid glTexParameterivGLenum targetGLenum pnameconst GLint * paramsParameterstarget
Specifies the target texture of the active texture unit,
which must be either GL_TEXTURE_2D or
GL_TEXTURE_CUBE_MAP.
pname
Specifies the symbolic name of a texture parameter.
pname can be one of the following:
GL_TEXTURE_MIN_FILTER,
GL_TEXTURE_MAG_FILTER,
GL_TEXTURE_WRAP_S, or
GL_TEXTURE_WRAP_T.
params
Specifies a pointer to an array where the value of
pname is stored.
Description
Texture mapping is a technique that applies an image onto an object's surface
as if the image were a decal or cellophane shrink-wrap.
The image is created in texture space,
with an
(s,
t)
coordinate system.
A texture is a two-dimensional or cube-mapped image and a set of parameters
that determine how samples are derived from the image.
glTexParameter assigns the value or values in params to the texture parameter
specified as pname.
target defines the target texture of the active texture unit,
either GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.
The following symbols are accepted in pname:
GL_TEXTURE_MIN_FILTER
The texture minifying function is used whenever the pixel being textured
maps to an area greater than one texture element.
There are six defined minifying functions.
Two of them use the nearest one or nearest four texture elements
to compute the texture value.
The other four use mipmaps.
A mipmap is an ordered set of arrays representing the same image
at progressively lower resolutions.
If the texture has dimensions
w×h,
there are
floor&af;log2&af;max&af;wh+1
mipmap levels.
The first mipmap level is the original texture,
with dimensions
w×h.
Each subsequent mipmap level has dimensions
max&af;1floor&af;w2i×max&af;1floor&af;h2i,
where
i
is the mipmap level,
until the final mipmap is reached,
which has dimension
1×1.
To define the mipmap levels, call glTexImage2D,
glCompressedTexImage2D,
or glCopyTexImage2D
with the level argument indicating the order of the mipmaps.
Level 0 is the original texture;
level
floor&af;log2&af;max&af;wh
is the final
1×1
mipmap.
params supplies a function for minifying the texture as one of the
following:
GL_NEAREST
Returns the value of the texture element that is nearest
(in Manhattan distance)
to the center of the pixel being textured.
GL_LINEAR
Returns the weighted average of the four texture elements
that are closest to the center of the pixel being textured.
GL_NEAREST_MIPMAP_NEAREST
Chooses the mipmap that most closely matches the size of the pixel
being textured and uses the GL_NEAREST criterion
(the texture element nearest to the center of the pixel)
to produce a texture value.
GL_LINEAR_MIPMAP_NEAREST
Chooses the mipmap that most closely matches the size of the pixel
being textured and uses the GL_LINEAR criterion
(a weighted average of the four texture elements that are closest
to the center of the pixel)
to produce a texture value.
GL_NEAREST_MIPMAP_LINEAR
Chooses the two mipmaps that most closely match the size of the pixel
being textured and uses the GL_NEAREST criterion
(the texture element nearest to the center of the pixel)
to produce a texture value from each mipmap.
The final texture value is a weighted average of those two values.
GL_LINEAR_MIPMAP_LINEAR
Chooses the two mipmaps that most closely match the size of the pixel
being textured and uses the GL_LINEAR criterion
(a weighted average of the four texture elements that are closest
to the center of the pixel)
to produce a texture value from each mipmap.
The final texture value is a weighted average of those two values.
As more texture elements are sampled in the minification process,
fewer aliasing artifacts will be apparent.
While the GL_NEAREST and GL_LINEAR minification functions can be
faster than the other four,
they sample only one or four texture elements to determine the texture value
of the pixel being rendered and can produce moire patterns
or ragged transitions.
The initial value of GL_TEXTURE_MIN_FILTER is
GL_NEAREST_MIPMAP_LINEAR.
GL_TEXTURE_MAG_FILTER
The texture magnification function is used when the pixel being textured
maps to an area less than or equal to one texture element.
It sets the texture magnification function to either GL_NEAREST
or GL_LINEAR (see below). GL_NEAREST is generally faster
than GL_LINEAR,
but it can produce textured images with sharper edges
because the transition between texture elements is not as smooth.
The initial value of GL_TEXTURE_MAG_FILTER is GL_LINEAR.
GL_NEAREST
Returns the value of the texture element that is nearest
(in Manhattan distance)
to the center of the pixel being textured.
GL_LINEAR
Returns the weighted average of the four texture elements
that are closest to the center of the pixel being textured.
GL_TEXTURE_WRAP_S
Sets the wrap parameter for texture coordinate
s
to either GL_CLAMP_TO_EDGE, GL_MIRRORED_REPEAT, or
GL_REPEAT. GL_CLAMP_TO_EDGE causes
s
coordinates to be clamped to the
range
12N1-12N,
where
N
is the size
of the texture in the direction of clamping. GL_REPEAT causes the
integer part of the
s
coordinate to be ignored; the GL uses only the
fractional part, thereby creating a repeating pattern.
GL_MIRRORED_REPEAT causes the
s
coordinate to be set to the
fractional part of the texture coordinate if the integer part of
s
is
even; if the integer part of
s
is odd, then the
s
texture coordinate is
set to
1-frac&af;s,
where
frac&af;s
represents the fractional part of
s.
Initially,
GL_TEXTURE_WRAP_S is set to GL_REPEAT.
GL_TEXTURE_WRAP_T
Sets the wrap parameter for texture coordinate
t
to either GL_CLAMP_TO_EDGE, GL_MIRRORED_REPEAT, or
GL_REPEAT. See the discussion under GL_TEXTURE_WRAP_S.
Initially, GL_TEXTURE_WRAP_T is set to GL_REPEAT.
Notes
Suppose that a texture is accessed from a fragment shader or vertex shader and
has set GL_TEXTURE_MIN_FILTER to one of the functions that requires
mipmaps. If either the dimensions of the texture images currently defined
(with previous calls to glTexImage2D,
glCompressedTexImage2D,
or glCopyTexImage2D) do not
follow the proper sequence for mipmaps (described above), or there are
fewer texture images defined than are needed, or the set of texture images
were defined with different formats or types, then the texture image unit will return
(R, G, B, A) = (0, 0, 0, 1).
Similarly, if the width or height of a texture image are not powers of two and either the
GL_TEXTURE_MIN_FILTER is set to one of the functions that requires mipmaps
or the GL_TEXTURE_WRAP_S or GL_TEXTURE_WRAP_T is not
set to GL_CLAMP_TO_EDGE, then the texture image unit will return
(R, G, B, A) = (0, 0, 0, 1).
glTexParameter
specifies the texture parameters for the texture bound to the active texture unit, specified
by calling glActiveTexture.
ErrorsGL_INVALID_ENUM is generated if target or pname is not
one of the accepted defined values.
GL_INVALID_ENUM is generated if params
should have a defined symbolic
constant value (based on the value of pname) and does not.
Associated GetsglGetTexParameterSee AlsoglActiveTexture,
glBindTexture,
glCopyTexImage2D,
glCopyTexSubImage2D,
glPixelStorei,
glTexImage2D,
glTexSubImage2DCopyright
Copyright 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
http://oss.sgi.com/projects/FreeB/.