GLTEXPARAMETER(3gl)GLTEXPARAMETER(3gl)NAME
glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv -
set texture parameters
C SPECIFICATION
void glTexParameterf( GLenum target,
GLenum pname,
GLfloat param )
void glTexParameteri( GLenum target,
GLenum pname,
GLint param )
PARAMETERS
target Specifies the target texture, must be GL_TEXTURE_1D, GL_TEX‐
TURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP or GL_DETAIL_TEX‐
TURE_2D_SGIS.
pname Specifies the symbolic name of a single-valued texture parame‐
ter. pname can be one of the following: GL_TEXTURE_MIN_FILTER,
GL_TEXTURE_MAG_FILTER, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T,
GL_TEXTURE_WRAP_R, GL_TEXTURE_PRIORITY, GL_TEXTURE_MIN_LOD,
GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, GL_TEX‐
TURE_MAX_LEVEL, GL_TEXTURE_COMPARE_FUNC, GL_GENERATE_MIPMAP,
GL_TEXTURE_LOD_BIAS_S_SGIX, GL_TEXTURE_LOD_BIAS_T_SGIX, or
GL_TEXTURE_LOD_BIAS_R_SGIX.
param Specifies the value of pname.
C SPECIFICATION
void glTexParameterfv( GLenum target,
GLenum pname,
const GLfloat *params )
void glTexParameteriv( GLenum target,
GLenum pname,
const GLint *params )
PARAMETERS
target Specifies the target texture, GL_TEXTURE_1D, GL_TEXTURE_2D,
GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP or GL_DETAIL_TEXTURE_2D_SGIS.
pname Specifies the symbolic name of a texture parameter. pname can
be one of the following: GL_TEXTURE_MIN_FILTER, GL_TEX‐
TURE_MAG_FILTER, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_TEX‐
TURE_WRAP_R, GL_LINEAR_DETAIL_SGIS, GL_LINEAR_DETAIL_ALPHA_SGIS,
GL_LINEAR_DETAIL_COLOR_SGIS, GL_TEXTURE_BORDER_COLOR, GL_TEX‐
TURE_PRIORITY, GL_TEXTURE_MIN_LOD, GL_TEXTURE_MAX_LOD, GL_TEX‐
TURE_BASE_LEVEL, GL_TEXTURE_MAX_LEVEL, GL_TEXTURE_COMPARE_FUNC,
GL_GENERATE_MIPMAP, GL_TEXTURE_LOD_BIAS_S_SGIX, GL_TEX‐
TURE_LOD_BIAS_T_SGIX, GL_TEXTURE_LOD_BIAS_R_SGIX. GL_POST_TEX‐
TURE_FILTER_SCALE_SGIX, GL_POST_TEXTURE_FILTER_BIAS_SGIX, or
GL_TEXTURE_MAX_ANISOTROPY_EXT.
params Specifies a pointer to an array where the value or values of
pname are 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, r) coordinate system.
A texture is a one- two- or three-dimensional image and a set of param‐
eters 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,
either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP
or GL_DETAIL_TEXTURE_2D_SGIS. 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 ele‐
ment. There are six defined minifying functions. Two of
them use the nearest one or nearest eight 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 2n×2m×2l at GL_TEXTURE_BASE_LEVEL, there are
max(n,m,l)+1 mipmaps. The first mipmap is the original tex‐
ture, with dimensions 2n×2m×2l. Each subsequent mipmap has
dimensions 2i−1×2j−1×2k−1, where 2i×2j×2k are the dimensions
of the previous mipmap, until either i=0, j=0 or k=0. At
that point, subsequent mipmaps have dimension 1×2j−1×2k−1 ,
2i−1×1×2k−1 or 2i−1×2j−1×1 until the final mipmap, which has
dimension 1×1×1. To define the mipmaps, call glTexImage1D,
glTexImage2D, glTexImage3D, glCopyTexImage1D, or glCopyTexIm‐
age2D with the level argument indicating the level-of-detail
number. The main texture image has a level-of-detail number
of 0.
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 eight texture
elements that are closest to the center of the
pixel being textured. These can include border
texture elements, depending on the values of
GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T, and on the
exact mapping.
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
eight texture elements that are closest to the cen‐
ter 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
eight texture elements that are closest to the cen‐
ter of the pixel) to produce a texture value from
each mipmap. The final texture value is a weighted
average of those two values.
GL_FILTER4_SGIS
This filtering mode allows 1D and 2D textures to be
filtered using an application-defined, four sample
per dimension filter. Such filtering results in
higher image quality. It is defined only for non-
mipmapped filters. Because filter4 filtering is
defined only for non-mipmapped textures, there is
no difference between its definition for minifica‐
tion and magnification. For more information, see
glTexFilterFuncSGIS.
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 four or
eight texture elements to determine the texture value of the
pixel being rendered and can produce more 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 tex‐
ture element. It sets the texture magnification function to
either GL_NEAREST, GL_LINEAR, GL_LINEAR_SHARPEN_SGIS, GL_LIN‐
EAR_SHARPEN_ALPHA_SGIS, or GL_LINEAR_SHARPEN_COLOR_SGIS (see
below). GL_NEAREST is generally fastest, 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 eight texture
elements that are closest to the center of the
pixel being textured. These can include border
texture elements, depending on the values of
GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, and GL_TEX‐
TURE_WRAP_R, and on the exact mapping.
GL_LINEAR_SHARPEN_SGIS
Samples the levels 0 and 1 texture arrays exactly
as GL_LINEAR and extrapolate the red, green, blue
and alpha components to produce the final red,
green, blue, and alpha components.
GL_LINEAR_SHARPEN_ALPHA_SGIS
Samples the levels 0 and 1 texture arrays exactly
as GL_LINEAR and extrapolate only the alpha compo‐
nent. The red, green, and blue components are those
of level 0.
GL_LINEAR_SHARPEN_COLOR_SGIS
Samples the levels 0 and 1 texture arrays exactly
as GL_LINEAR and extrapolate the red, green and
blue components. The alpha component is that of
level 0. GL_FILTER4_SGIS Returns the Filter4 fil‐
tered texture element. See GL_FILTER4_SGIS under
GL_TEXTURE_MIN_FILTER
GL_TEXTURE_WRAP_S
Sets the wrap parameter for texture coordinate s to either
GL_CLAMP, GL_CLAMP_TO_EDGE, GL_REPEAT, or GL_CLAMP_TO_BOR‐
DER_ARB. GL_CLAMP causes s coordinates to be clamped to the
range [0,1] and is useful for preventing wrapping artifacts
when mapping a single image onto an object. GL_CLAMP_TO_EDGE
causes the s coordinate to be clamped to the range 1/2N, 1 -
1/2N, where N is the size of the texture in the direction of
clamping. GL_REPEAT causes the integer part of the s coordi‐
nate to be ignored; the GL uses only the fractional part,
thereby creating a repeating pattern. Border texture ele‐
ments are accessed only if wrapping is set to GL_CLAMP.
GL_CLAMP_TO_BORDER_ARB clamps texture coordinates such that
the texture filter always samples border texels for fragments
whose corresponding texture coordinate is sufficiently far
outside the range [0,1]. The color returned when clamping is
derived only from the border texels of the texture image, or
from the constant border color if the texture image does not
have a border. Texture coordinates are clamped to the range
[min, max]. The minimum value is defined as min = -1 / 2N,
where N is the size (not including borders) of the one-,
two-, or three-dimensional texture image in the direction of
clamping. The maximum value is defined as max = 1 - min, so
that clamping is always symmetric about the [0,1] mapped
range of a texture coordinate. 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, GL_CLAMP_TO_EDGE, GL_REPEAT, or GL_CLAMP_TO_BOR‐
DER_ARB. See the discussion under GL_TEXTURE_WRAP_S. Ini‐
tially, GL_TEXTURE_WRAP_T is set to GL_REPEAT.
GL_TEXTURE_WRAP_R
Sets the wrap parameter for texture coordinate r of 3D tex‐
tures. See the discussion under GL_TEXTURE_WRAP_S. Ini‐
tially, GL_TEXTURE_WRAP_R is set to GL_REPEAT.
GL_TEXTURE_BORDER_COLOR
Sets a border color. params contains four values that com‐
prise the RGBA color of the texture border. Integer color
components are interpreted linearly such that the most posi‐
tive integer maps to 1.0, and the most negative integer maps
to -1.0. The values are clamped to the range [0,1] when they
are specified. Initially, the border color is (0, 0, 0, 0).
GL_TEXTURE_PRIORITY
Specifies the texture residence priority of the currently
bound texture. Permissible values are in the range [0, 1].
See glPrioritizeTextures and glBindTexture for more informa‐
tion.
GL_POST_TEXTURE_FILTER_SCALE_SGIX
Specifies the scale values with params set to an array of
four values. The scale values can be queried using GetTexPa‐
rameterfv or GetTexParameteriv. The scale operation is
applied directly before the texture environment equations,
or, if the SGI_texture_color_table extension exists, directly
before the texture color lookup table. The four values for
scale correspond to the R, G, B, and A scale factors. These
are applied to the corresponding texture components, Rt, Gt,
Bt, and At, as denoted in the EXT_texture extension. Follow‐
ing the scale and bias is a clamp to [0, 1]. The scale oper‐
ation is effectively disabled by setting the four scale val‐
ues to 1. There is no specific enable or disable token for
this extension.
GL_POST_TEXTURE_FILTER_BIAS_SGIX
Specifies the bias values with params set to an array of four
values. The bias values can be queried using GetTexParame‐
terfv or GetTexParameteriv. The bias operation is applied
directly before the texture environment equations, or, if the
SGI_texture_color_table extension exists, directly before the
texture color lookup table, following the scale operation.
The four values for bias correspond to the R, G, B, and A
bias factors. These are applied to the corresponding texture
components, Rt, Gt, Bt, and At, as denoted in the EXT_texture
extension. Following the scale and bias is a clamp to [0,
1]. The bias operation is effectively disabled by setting
the four bias values to 1. There is no specific enable or
disable token for this extension.
GL_TEXTURE_MAX_ANISOTROPY_EXT
Specifies the maximum degree of anisotropy needed, with
params set to an array of one floating-point value greater
than or equal to 1.0. When the texture's value of GL_TEX‐
TURE_MAX_ANISOTROPY_EXT is equal to 1.0, the GL uses an iso‐
tropic texture filtering approach. However, when the tex‐
ture's value of TEXTURE_MAX_ANISOTROPY_EXT is greater than
1.0, the GL implementation uses a texture filtering scheme
that accounts for a degree of anisotropy up to the smaller of
the value of GL_TEXTURE_MAX_ANISTROPY_EXT or the implementa‐
tion-defined value of GL_MAX_TEXTURE_MAX_ANISTROPY_EXT. The
anisotropic texture filtering scheme may only access mipmap
levels if the minification filter is one that requires
mipmaps. Additionally, when a minification filter is speci‐
fied, the anisotropic texture filtering scheme may only
access texture mipmap levels between the texture's values for
TEXTURE_BASE_LEVEL and TEXTURE_MAX_LEVEL, inclusive.
GL_MAX_TEXTURE_MAX_ANISTROPY_EXT can be quieried using Get‐
Floatv command.
GL_TEXTURE_MIN_LOD
Specifies the minimum level-of-detail number. If the calcu‐
lated level-of-detail number is smaller than GL_TEX‐
TURE_MIN_LOD, it is clamped to GL_TEXTURE_MIN_LOD. Whether
the minification or magnification filter is used depends on
the clamped LOD value. The initial value is 0.
GL_TEXTURE_MAX_LOD
Specifies the maximum level-of-detail number. If the calcu‐
lated level-of-detail number is larger than GL_TEX‐
TURE_MIN_LOD, it is clamped to GL_TEXTURE_MAX_LOD The initial
value is 1000 and the permissible value is > 0.
GL_TEXTURE_BASE_LEVEL
Specifies the base level-of-the texture arrays. Level-of-
detail numbers proceed from GL_TEXTURE_BASE_LEVELfor the
original texture array through p = max {n,m,l} + GL_TEX‐
TURE_BASE_LEVEL. The initial value is 0 and the permissible
value is > 0.
GL_TEXTURE_MAX_LEVEL
Specifies the maximum level-of-detail number. The texture
arrays are defined from GL_TEXTURE_BASE_LEVEL through min {
p, GL_TEXTURE_MAX_LEVEL }. The initial value is 1000 and the
permissible value is > 0.
GL_TEXTURE_COMPARE_FUNC
Specifies the texture comparation function to either
GL_LEQUAL, GL_GEQUAL, GL_LESS, GL_GREATER, GL_EQUAL, GL_NOTE‐
QUAL, GL_ALWAYS, or GL_NEVER.
GL_TEXTURE_LOD_BIAS_S_SGIX
Specifies the bias applied to s in the level-of-detail calcu‐
lation. The mipmapped textures can be made to appear sharper
or blurrier by supplying a negative or positive bias respec‐
tively. The initial value is 0.
GL_TEXTURE_LOD_BIAS_T_SGIX
Specifies the bias applied to t in the level-of-detail calcu‐
lation. The initial value is 0.
GL_TEXTURE_LOD_BIAS_R_SGIX
Specifies the bias applied to r in the level-of-detail calcu‐
lation. The initial value is 0.
GL_GENERATE_MIPMAP
Specifies the side effect of modification of the base level
mipmap array. If enabled, any change made to the base level
texture will trigger a computation of a complete set of
mipmap arrays. The initial value is FALSE.
NOTES
Suppose that a program has enabled texturing (by calling glEnable with
argument GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, or GL_TEX‐
TURE_CUBE_MAP) and has set GL_TEXTURE_MIN_FILTER to one of the func‐
tions that requires a mipmap. If either the dimensions of the texture
images currently defined (with previous calls to glTexImage1D, glTexIm‐
age2D, glTexImage3D, glCopyTexImage1D, or glCopyTexImage2D) do not fol‐
low the proper sequence for mipmaps (described above), or there are
fewer texture images defined than are needed, or the set of texture
images have differing numbers of texture components, then it is as if
texture mapping were disabled.
Linear filtering accesses the eight nearest texture elements in 3D tex‐
tures, the four nearest texture elements in 2D textures, and the two
nearest texture elements in 1D textures..
ERRORS
GL_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 constant
value (based on the value of pname) and does not.
GL_INVALID_OPERATION is generated if glTexParameter is executed between
the execution of glBegin and the corresponding execution of glEnd.
GL_INVALID_VALUE is generated if pname is GL_DETAIL_TEXTURE_LEVEL_SGIS
and param is positive or params points to a positive value.
GL_INVALID_VALUE is generated when TexParameter is called with pname of
TEXTURE_MAX_ANISOTROPY_EXT and a param value or value of what params
points to less than 1.0.
ASSOCIATED GETS
glGetTexParameter
glGetTexLevelParameter
SEE ALSO
glBindTexture, glCopyPixels, glCopyTexImage1D, glCopyTexImage2D,
glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, glDraw‐
Pixels, glPixelStore, glPixelTransfer, glPrioritizeTextures, glTexEnv,
glTexGen, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D,
glTexSubImage2D, glTexSubImage3D, glSharpenTexFuncSGIS, glGetSharpen‐
TexFuncSGIS.
6 June 01 GLTEXPARAMETER(3gl)