table of contents
GLTEXPARAMETER(3G) | [FIXME: manual] | GLTEXPARAMETER(3G) |
NAME¶
glTexParameter, glTextureParameter - set texture parameters
C SPECIFICATION¶
void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
void glTexParameteri(GLenum target, GLenum pname, GLint param);
void glTextureParameterf(GLuint texture, GLenum pname, GLfloat param);
void glTextureParameteri(GLuint texture, GLenum pname, GLint param);
void glTexParameterfv(GLenum target, GLenum pname, const GLfloat * params);
void glTexParameteriv(GLenum target, GLenum pname, const GLint * params);
void glTexParameterIiv(GLenum target, GLenum pname, const GLint * params);
void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint * params);
void glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat *paramtexture.);
void glTextureParameteriv(GLuint texture, GLenum pname, const GLint *param);
void glTextureParameterIiv(GLuint texture, GLenum pname, const GLint *params);
void glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params);
PARAMETERS¶
target
texture
pname
For the vector commands (glTexParameter*v), pname can also be one of GL_TEXTURE_BORDER_COLOR or GL_TEXTURE_SWIZZLE_RGBA.
param
params
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
GL_TEXTURE_BASE_LEVEL
GL_TEXTURE_BORDER_COLOR
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: f = 2 c + 1 2 b - 1. If specified with glTexParameterfv, they are stored unmodified as floating-point values.
GL_TEXTURE_COMPARE_FUNC
Texture Comparison Function | Computed result |
GL_LEQUAL | result = 1.0 0.0 r <= D t r > D t |
GL_GEQUAL | result = 1.0 0.0 r >= D t r < D t |
GL_LESS | result = 1.0 0.0 r < D t r >= D t |
GL_GREATER | result = 1.0 0.0 r > D t r <= D t |
GL_EQUAL | result = 1.0 0.0 r = D t r ≠ D t |
GL_NOTEQUAL | result = 1.0 0.0 r ≠ D t r = D t |
GL_ALWAYS | result = 1.0 |
GL_NEVER | result = 0.0 |
where r is the current interpolated texture coordinate, and D t is the depth texture value sampled from the currently bound depth texture. result is assigned to the the red channel.
GL_TEXTURE_COMPARE_MODE
GL_COMPARE_REF_TO_TEXTURE
GL_NONE
GL_TEXTURE_LOD_BIAS
GL_TEXTURE_MIN_FILTER
A mipmap is an ordered set of arrays representing the same image at progressively lower resolutions. If the texture has dimensions 2 n × 2 m, there are max n m + 1 mipmaps. The first mipmap is the original texture, with dimensions 2 n × 2 m. Each subsequent mipmap has dimensions 2 k - 1 × 2 l - 1, where 2 k × 2 l are the dimensions of the previous mipmap, until either k = 0 or l = 0. At that point, subsequent mipmaps have dimension 1 × 2 l - 1 or 2 k - 1 × 1 until the final mipmap, which has dimension 1 × 1. 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 max n m is the final 1 × 1 mipmap.
params supplies a function for minifying the texture as one of the following:
GL_NEAREST
GL_LINEAR
GL_NEAREST_MIPMAP_NEAREST
GL_LINEAR_MIPMAP_NEAREST
GL_NEAREST_MIPMAP_LINEAR
GL_LINEAR_MIPMAP_LINEAR
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
GL_NEAREST
GL_LINEAR
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_SWIZZLE_RGBA
GL_TEXTURE_WRAP_S
GL_TEXTURE_WRAP_T
GL_TEXTURE_WRAP_R
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 by glTexParameter if target is not one of the accepted defined values.
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.
GL_INVALID_VALUE is generated if pname is GL_TEXTURE_BASE_LEVEL or GL_TEXTURE_MAX_LEVEL, and param or params is negative.
ASSOCIATED GETS¶
glGetTexParameter()
glGetTextureParameter
glGetTexLevelParameter()
glGetTextureLevelParameter
VERSION SUPPORT¶
OpenGL Version | ||||||||||||
Function / Feature Name | 2.0 | 2.1 | 3.0 | 3.1 | 3.2 | 3.3 | 4.0 | 4.1 | 4.2 | 4.3 | 4.4 | 4.5 |
glTexParameterIiv | - | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glTexParameterIuiv | - | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glTexParameterf | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glTexParameterfv | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glTexParameteri | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glTexParameteriv | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glTextureParameterIiv | - | - | - | - | - | - | - | - | - | - | - | ✔ |
glTextureParameterIuiv | - | - | - | - | - | - | - | - | - | - | - | ✔ |
glTextureParameterf | - | - | - | - | - | - | - | - | - | - | - | ✔ |
glTextureParameterfv | - | - | - | - | - | - | - | - | - | - | - | ✔ |
glTextureParameteri | - | - | - | - | - | - | - | - | - | - | - | ✔ |
glTextureParameteriv | - | - | - | - | - | - | - | - | - | - | - | ✔ |
SEE ALSO¶
glActiveTexture(), glBindTexture(), glCopyTexImage1D(), glCopyTexImage2D(), glCopyTexSubImage1D(), glCopyTexSubImage2D(), glCopyTexSubImage3D(), glPixelStore(), glSamplerParameter(), glTexImage1D(), glTexImage2D(), glTexImage3D(), glTexSubImage1D(), glTexSubImage2D(), glTexSubImage3D()
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/.
COPYRIGHT¶
Copyright © 1991-2006 Silicon Graphics, Inc.
Copyright © 2012-2014 Khronos Group
04/12/2021 | [FIXME: source] |