Signature
Parameters
Variables | Description |
---|---|
target |
Specifies the target to which the texture is bound for
glTexParameter
functions. Must be one of
GL_TEXTURE_1D
,
GL_TEXTURE_1D_ARRAY
,
GL_TEXTURE_2D
,
GL_TEXTURE_2D_ARRAY
,
GL_TEXTURE_2D_MULTISAMPLE
,
GL_TEXTURE_2D_MULTISAMPLE_ARRAY
,
GL_TEXTURE_3D
,
GL_TEXTURE_CUBE_MAP
,
GL_TEXTURE_CUBE_MAP_ARRAY
, or
GL_TEXTURE_RECTANGLE
.
|
texture |
Specifies the texture object name for
glTextureParameter
functions.
|
pname |
Specifies the symbolic name of a single-valued texture
parameter.
pname
can be one of the following:
GL_DEPTH_STENCIL_TEXTURE_MODE
,
GL_TEXTURE_BASE_LEVEL
,
GL_TEXTURE_COMPARE_FUNC
,
GL_TEXTURE_COMPARE_MODE
,
GL_TEXTURE_LOD_BIAS
,
GL_TEXTURE_MIN_FILTER
,
GL_TEXTURE_MAG_FILTER
,
GL_TEXTURE_MIN_LOD
,
GL_TEXTURE_MAX_LOD
,
GL_TEXTURE_MAX_LEVEL
,
GL_TEXTURE_SWIZZLE_R
,
GL_TEXTURE_SWIZZLE_G
,
GL_TEXTURE_SWIZZLE_B
,
GL_TEXTURE_SWIZZLE_A
,
GL_TEXTURE_WRAP_S
,
GL_TEXTURE_WRAP_T
, or
GL_TEXTURE_WRAP_R
.
|
param |
For the scalar commands, specifies the value of
pname
.
|
params |
For the vector commands, specifies a pointer to an array where
the value or values of
pname
are
stored.
|
Description
glTexParameter
and
glTextureParameter
assign the value or values in
params
to the texture parameter specified as
pname
. For
glTexParameter
,
target
defines the target texture, either
GL_TEXTURE_1D
,
GL_TEXTURE_1D_ARRAY
,
GL_TEXTURE_2D
,
GL_TEXTURE_2D_ARRAY
,
GL_TEXTURE_2D_MULTISAMPLE
,
GL_TEXTURE_2D_MULTISAMPLE_ARRAY
,
GL_TEXTURE_3D
,
GL_TEXTURE_CUBE_MAP
,
GL_TEXTURE_CUBE_MAP_ARRAY
, or
GL_TEXTURE_RECTANGLE
. The following symbols are
accepted in
pname
:
- GL_DEPTH_STENCIL_TEXTURE_MODE
-
Specifies the mode used to read from depth-stencil format textures. params must be one of GL_DEPTH_COMPONENT or GL_STENCIL_INDEX . If the depth stencil mode is GL_DEPTH_COMPONENT , then reads from depth-stencil format textures will return the depth component of the texel in and the stencil component will be discarded. If the depth stencil mode is GL_STENCIL_INDEX then the stencil component is returned in and the depth component is discarded. The initial value is GL_DEPTH_COMPONENT .
- GL_TEXTURE_BASE_LEVEL
-
Specifies the index of the lowest defined mipmap level. This is an integer value. The initial value is 0.
- GL_TEXTURE_BORDER_COLOR
-
The data in params specifies four values that define the border values that should be used for border texels. If a texel is sampled from the border of the texture, the values of GL_TEXTURE_BORDER_COLOR are interpreted as an RGBA color to match the texture's internal format and substituted for the non-existent texel data. If the texture contains depth components, the first component of GL_TEXTURE_BORDER_COLOR is interpreted as a depth value. The initial value is .If the values for GL_TEXTURE_BORDER_COLOR are specified with glTexParameterIiv or glTexParameterIuiv , the values are stored unmodified with an internal data type of integer. If specified with glTexParameteriv , they are converted to floating point with the following equation: . If specified with glTexParameterfv , they are stored unmodified as floating-point values.
- GL_TEXTURE_COMPARE_FUNC
-
Specifies the comparison operator used when GL_TEXTURE_COMPARE_MODE is set to GL_COMPARE_REF_TO_TEXTURE . Permissible values are:
Texture Comparison Function Computed result GL_LEQUAL GL_GEQUAL GL_LESS GL_GREATER GL_EQUAL GL_NOTEQUAL GL_ALWAYS GL_NEVER - GL_TEXTURE_COMPARE_MODE
-
Specifies the texture comparison mode for currently bound depth textures. That is, a texture whose internal format is GL_DEPTH_COMPONENT_* ; see glTexImage2D ) Permissible values are:
- GL_COMPARE_REF_TO_TEXTURE
-
Specifies that the interpolated and clamped texture coordinate should be compared to the value in the currently bound depth texture. See the discussion of GL_TEXTURE_COMPARE_FUNC for details of how the comparison is evaluated. The result of the comparison is assigned to the red channel.
- GL_NONE
-
Specifies that the red channel should be assigned the appropriate value from the currently bound depth texture.
- GL_TEXTURE_LOD_BIAS
-
params specifies a fixed bias value that is to be added to the level-of-detail parameter for the texture before texture sampling. The specified value is added to the shader-supplied bias value (if any) and subsequently clamped into the implementation-defined range , where is the value of the implementation defined constant GL_MAX_TEXTURE_LOD_BIAS . The initial value is 0.0.
- GL_TEXTURE_MIN_FILTER
-
The texture minifying function is used whenever the level-of-detail function used when sampling from the texture determines that the texture should be minified. There are six defined minifying functions. Two of them use either the nearest texture elements or a weighted average of multiple 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 , there are mipmaps. The first mipmap is the original texture, with dimensions . Each subsequent mipmap has dimensions , where are the dimensions of the previous mipmap, until either or . At that point, subsequent mipmaps have dimension or until the final mipmap, which has dimension . To define the mipmaps, call glTexImage1D , glTexImage2D , glTexImage3D , glCopyTexImage1D , or glCopyTexImage2D with the level argument indicating the order of the mipmaps. Level 0 is the original texture; level is the final 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 specified texture coordinates.
- GL_LINEAR
-
Returns the weighted average of the four texture elements that are closest to the specified texture coordinates. These can include items wrapped or repeated from other parts of a texture, 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 closest to the specified texture coordinates) 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 specified texture coordinates) 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 closest to the specified texture coordinates ) 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 texture elements that are closest to the specified texture coordinates) 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 multiple 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 whenever the level-of-detail function used when sampling from the texture determines that the texture should be magified. 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 specified texture coordinates.
- GL_LINEAR
-
Returns the weighted average of the texture elements that are closest to the specified texture coordinates. These can include items wrapped or repeated from other parts of a texture, depending on the values of GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T , and on the exact mapping.
- GL_TEXTURE_MIN_LOD
-
Sets the minimum level-of-detail parameter. This floating-point value limits the selection of highest resolution mipmap (lowest mipmap level). The initial value is -1000.
- GL_TEXTURE_MAX_LOD
-
Sets the maximum level-of-detail parameter. This floating-point value limits the selection of the lowest resolution mipmap (highest mipmap level). The initial value is 1000.
- GL_TEXTURE_MAX_LEVEL
-
Sets the index of the highest defined mipmap level. This is an integer value. The initial value is 1000.
- GL_TEXTURE_SWIZZLE_R
-
Sets the swizzle that will be applied to the component of a texel before it is returned to the shader. Valid values for param are GL_RED , GL_GREEN , GL_BLUE , GL_ALPHA , GL_ZERO and GL_ONE . If GL_TEXTURE_SWIZZLE_R is GL_RED , the value for will be taken from the first channel of the fetched texel. If GL_TEXTURE_SWIZZLE_R is GL_GREEN , the value for will be taken from the second channel of the fetched texel. If GL_TEXTURE_SWIZZLE_R is GL_BLUE , the value for will be taken from the third channel of the fetched texel. If GL_TEXTURE_SWIZZLE_R is GL_ALPHA , the value for will be taken from the fourth channel of the fetched texel. If GL_TEXTURE_SWIZZLE_R is GL_ZERO , the value for will be subtituted with . If GL_TEXTURE_SWIZZLE_R is GL_ONE , the value for will be subtituted with . The initial value is GL_RED .
- GL_TEXTURE_SWIZZLE_G
-
Sets the swizzle that will be applied to the component of a texel before it is returned to the shader. Valid values for param and their effects are similar to those of GL_TEXTURE_SWIZZLE_R . The initial value is GL_GREEN .
- GL_TEXTURE_SWIZZLE_B
-
Sets the swizzle that will be applied to the component of a texel before it is returned to the shader. Valid values for param and their effects are similar to those of GL_TEXTURE_SWIZZLE_R . The initial value is GL_BLUE .
- GL_TEXTURE_SWIZZLE_A
-
Sets the swizzle that will be applied to the component of a texel before it is returned to the shader. Valid values for param and their effects are similar to those of GL_TEXTURE_SWIZZLE_R . The initial value is GL_ALPHA .
- GL_TEXTURE_SWIZZLE_RGBA
-
Sets the swizzles that will be applied to the , , , and components of a texel before they are returned to the shader. Valid values for params and their effects are similar to those of GL_TEXTURE_SWIZZLE_R , except that all channels are specified simultaneously. Setting the value of GL_TEXTURE_SWIZZLE_RGBA is equivalent (assuming no errors are generated) to setting the parameters of each of GL_TEXTURE_SWIZZLE_R , GL_TEXTURE_SWIZZLE_G , GL_TEXTURE_SWIZZLE_B , and GL_TEXTURE_SWIZZLE_A successively.
- GL_TEXTURE_WRAP_S
-
Sets the wrap parameter for texture coordinate to either GL_CLAMP_TO_EDGE , GL_CLAMP_TO_BORDER , GL_MIRRORED_REPEAT , GL_REPEAT , or GL_MIRROR_CLAMP_TO_EDGE . GL_CLAMP_TO_EDGE causes coordinates to be clamped to the range , where is the size of the texture in the direction of clamping. GL_CLAMP_TO_BORDER evaluates coordinates in a similar manner to GL_CLAMP_TO_EDGE . However, in cases where clamping would have occurred in GL_CLAMP_TO_EDGE mode, the fetched texel data is substituted with the values specified by GL_TEXTURE_BORDER_COLOR . GL_REPEAT causes the integer part of the coordinate to be ignored; the GL uses only the fractional part, thereby creating a repeating pattern. GL_MIRRORED_REPEAT causes the coordinate to be set to the fractional part of the texture coordinate if the integer part of is even; if the integer part of is odd, then the texture coordinate is set to , where represents the fractional part of . GL_MIRROR_CLAMP_TO_EDGE causes the coordinate to be repeated as for GL_MIRRORED_REPEAT for one repetition of the texture, at which point the coordinate to be clamped as in GL_CLAMP_TO_EDGE . Initially, GL_TEXTURE_WRAP_S is set to GL_REPEAT .
- GL_TEXTURE_WRAP_T
-
Sets the wrap parameter for texture coordinate to either GL_CLAMP_TO_EDGE , GL_CLAMP_TO_BORDER , GL_MIRRORED_REPEAT , GL_REPEAT , or GL_MIRROR_CLAMP_TO_EDGE . See the discussion under GL_TEXTURE_WRAP_S . Initially, GL_TEXTURE_WRAP_T is set to GL_REPEAT .
- GL_TEXTURE_WRAP_R
-
Sets the wrap parameter for texture coordinate to either GL_CLAMP_TO_EDGE , GL_CLAMP_TO_BORDER , GL_MIRRORED_REPEAT , GL_REPEAT , or GL_MIRROR_CLAMP_TO_EDGE . See the discussion under GL_TEXTURE_WRAP_S . Initially, GL_TEXTURE_WRAP_R is set to GL_REPEAT .
Notes
Suppose that a program attempts to sample from a texture and has set
GL_TEXTURE_MIN_FILTER
to one of the functions that
requires a mipmap. If either the dimensions of the texture images
currently defined (with previous calls to
glTexImage1D
,
glTexImage2D
,
glTexImage3D
,
glCopyTexImage1D
,
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 have differing numbers of texture components, then the
texture is considered
incomplete
.
Linear filtering accesses the four nearest texture elements only in
2D textures. In 1D textures, linear filtering accesses the two nearest
texture elements. In 3D textures, linear filtering accesses the eight
nearest texture elements.
glTexParameter
specifies the texture
parameters for the active texture unit, specified by calling
glActiveTexture
.
glTextureParameter
specifies the texture parameters
for the texture object with ID
texture
.
GL_DEPTH_STENCIL_TEXTURE_MODE
is available only
if the GL version is 4.3 or greater.
GL_MIRROR_CLAMP_TO_EDGE
is available only if
the GL version is 4.4 or greater.
Errors
GL_INVALID_ENUM
is generated if
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_ENUM
is generated if
glTexParameter{if}
or
glTextureParameter{if}
is called for a non-scalar
parameter (pname
GL_TEXTURE_BORDER_COLOR
or
GL_TEXTURE_SWIZZLE_RGBA
).
GL_INVALID_ENUM
is generated if the effective
target is either
GL_TEXTURE_2D_MULTISAMPLE
or
GL_TEXTURE_2D_MULTISAMPLE_ARRAY
, and
pname
is any of the sampler states.
GL_INVALID_ENUM
is generated if the effective
target is
GL_TEXTURE_RECTANGLE
and either of pnames
GL_TEXTURE_WRAP_S
or
GL_TEXTURE_WRAP_T
is set to either
GL_MIRROR_CLAMP_TO_EDGE
,
GL_MIRRORED_REPEAT
or
GL_REPEAT
.
GL_INVALID_ENUM
is generated if the effective
target is
GL_TEXTURE_RECTANGLE
and pname
GL_TEXTURE_MIN_FILTER
is set to a value other than
GL_NEAREST
or
GL_LINEAR
(no
mipmap filtering is permitted).
GL_INVALID_OPERATION
is generated if the
effective target is either
GL_TEXTURE_2D_MULTISAMPLE
or
GL_TEXTURE_2D_MULTISAMPLE_ARRAY
, and pname
GL_TEXTURE_BASE_LEVEL
is set to a value other than
zero.
GL_INVALID_OPERATION
is generated by
glTextureParameter
if texture is not the name of an
existing texture object.
GL_INVALID_OPERATION
is generated if the
effective target is
GL_TEXTURE_RECTANGLE
and pname
GL_TEXTURE_BASE_LEVEL
is set to any value other than
zero.
Associated Gets
Version Support
See Also
Copyright
Copyright
1991-2006
Silicon Graphics, Inc.
Copyright
2012-2014
Khronos Group. This document is licensed under the SGI
Free Software B License. For details, see
http://oss.sgi.com/projects/FreeB/
.
Sample Code References
The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.
glTexParameter
glTexParameterf
{LGPL or GPL or MPL} Kamaelia
Code/Python/Kamaelia/Kamaelia/Visualisation/PhysicsGraph3D/Particles3D.py
Lines: 413, 414
{LGPL or GPL or MPL} Kamaelia
Code/Python/Kamaelia/Kamaelia/UI/OpenGL/OpenGLDisplay.py
Lines: 902, 903
{LGPL or GPL or MPL} Kamaelia
Sketches/CL/Topology3D/THF/Kamaelia/UI/OpenGL/OpenGLDisplay.py
Lines: 880, 881
{LGPL or GPL or MPL} Kamaelia
Sketches/CL/Topology3D/THF/Kamaelia/UI/OpenGL/Button.py
Lines: 268, 269
{LGPL or GPL or MPL} Kamaelia
Sketches/CL/Topology3D/THF/Kamaelia/UI/OpenGL/TexPlane.py
Lines: 137, 138
{LGPL or GPL or MPL} Kamaelia
Sketches/CL/Topology3D/THF/Kamaelia/UI/OpenGL/Label.py
Lines: 205, 206
{LGPL or GPL or MPL} Kamaelia
Sketches/CL/Topology3D/THF/Sketches/playground/Button.py
Lines: 171, 172
{LGPL or GPL or MPL} Kamaelia
Sketches/CL/Topology3D/THF/Sketches/playground/TexPlane.py
Lines: 97, 98
{LGPL or GPL or MPL} Kamaelia
Sketches/CL/Topology3D/THF/Sketches/playground/Display3D.py
Lines: 493, 494
{LGPL or GPL or MPL} Kamaelia
Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Visualisation/PhysicsGraph3D/Particles3D.py
Lines: 413, 414
{LGPL or GPL or MPL} Kamaelia
Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/UI/OpenGL/OpenGLDisplay.py
Lines: 902, 903
{LGPL or GPL or MPL} Kamaelia
Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/UI/OpenGL/Button.py
Lines: 257, 258
{LGPL or GPL or MPL} Kamaelia
Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/UI/OpenGL/TexPlane.py
Lines: 137, 138
{LGPL or GPL or MPL} Kamaelia
Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/UI/OpenGL/Label.py
Lines: 205, 206
{LGPL or GPL or MPL} Kamaelia
Sketches/THF/Packages/Kamaelia/Community/THF/Kamaelia/UI/OpenGL/OpenGLDisplay.py
Lines: 879, 880
{LGPL or GPL or MPL} Kamaelia
Sketches/THF/Packages/Kamaelia/Community/THF/Kamaelia/UI/OpenGL/Button.py
Lines: 257, 258
{LGPL or GPL or MPL} Kamaelia
Sketches/THF/Packages/Kamaelia/Community/THF/Kamaelia/UI/OpenGL/TexPlane.py
Lines: 137, 138
{LGPL or GPL or MPL} Kamaelia
Sketches/THF/Packages/Kamaelia/Community/THF/Kamaelia/UI/OpenGL/Label.py
Lines: 205, 206
glTexParameteri
{LGPL or GPL or MPL} Kamaelia
Sketches/CL/Topology3D/Experiments/Cubes.py
Lines: 156, 157, 160, 161, 166, 167
glTexParameteriv