GLSAMPLERPARAMETER(3G) | OpenGL 3.3 | GLSAMPLERPARAMETER(3G) |
glSamplerParameter - set sampler parameters
void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
sampler
pname
param
void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat * params);
void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint * params);
sampler
pname
params
glSamplerParameter assigns the value or values in params to the sampler parameter specified as pname. sampler specifies the sampler object to be modified, and must be the name of a sampler object previously returned from a call to glGenSamplers(). The following symbols are accepted in pname:
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 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
GL_NEAREST
GL_LINEAR
GL_TEXTURE_MIN_LOD
GL_TEXTURE_MAX_LOD
GL_TEXTURE_WRAP_S
GL_TEXTURE_WRAP_T
GL_TEXTURE_WRAP_R
GL_TEXTURE_BORDER_COLOR
GL_TEXTURE_COMPARE_MODE
GL_COMPARE_REF_TO_TEXTURE
GL_NONE
GL_TEXTURE_COMPARE_FUNC
Texture Comparison Function | Computed result |
GL_LEQUAL | <div> result = 1.0 0.0 r <= D t r > D t </div> |
GL_GEQUAL | <div> result = 1.0 0.0 r >= D t r < D t </div> |
GL_LESS | <div> result = 1.0 0.0 r < D t r >= D t </div> |
GL_GREATER | <div> result = 1.0 0.0 r > D t r <= D t </div> |
GL_EQUAL | <div> result = 1.0 0.0 r = D t r ≠ D t </div> |
GL_NOTEQUAL | <div> result = 1.0 0.0 r ≠ D t r = D t </div> |
GL_ALWAYS | <div> result = 1.0 </div> |
GL_NEVER | <div> result = 0.0 </div> |
where r is the current interpolated texture coordinate, and D t is the texture value sampled from the currently bound texture. result is assigned to R t.
glSamplerParameter is available only if the GL version is 3.3 or higher.
If a sampler object is bound to a texture unit and that unit is used to sample from a texture, the parameters in the sampler are used to sample from the texture, rather than the equivalent parameters in the texture object bound to that unit. This introduces the possibility of sampling from the same texture object with different sets of sampler state, which may lead to a condition where a texture is incomplete with respect to one sampler object and not with respect to another. Thus, completeness can be considered a function of a sampler object and a texture object bound to a single texture unit, rather than a property of the texture object itself.
GL_INVALID_VALUE is generated if sampler is not the name of a sampler object previously returned from a call to glGenSamplers().
GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.
glGetSamplerParameter()
glGenSamplers(), glBindSampler(), glDeleteSamplers(), glIsSampler(), glBindTexture(), glTexParameter()
Copyright © 2010 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
03/08/2011 | OpenGL 3.3 |