GLTEXFILTERFUNCSGIS(3GL)GLTEXFILTERFUNCSGIS(3GL)NAME
glTexfilterfuncSGIS - specifies Filter4 filter function.
C SPECIFICATION
void glTexfilterfuncSGIS( GLenum target,
GLenum filter,
GLint n,
const GLfloat * weights )
PARAMETERS
target The target texture. Must be GL_TEXTURE_1D or GL_TEXTURE_2D.
filter The filter mode. Must be GL_FILTER4_SGIS.
n The filter table size. Must equal 2**m+1 for some non -ve
integer m.
weights Pointer to array of filter weights
DESCRIPTION
glTexfilterfuncSGIS, is part of the SGIS_texture_filter4 extension.
This extension allows 1D and 2D textures to be filtered using an appli‐
cation-defined, four sample per dimension filter. (In addition to the
NEAREST and LINEAR filters defined in the original GL Specification.)
Such filtering results in higher image quality. It is defined only for
non-mipmapped filters. The filter that is specified must be symmetric
and separable (in the 2D case).
Filter4 filtering is specified by calling TexParameteri, TexParameterf,
TexParameteriv, or TexParameterfv with <pname> set to one of TEX‐
TURE_MIN_FILTER or TEXTURE_MAG_FILTER, and <param> or <params> set to
FILTER4_SGIS. Because filter4 filtering is defined only for non-
mipmapped textures, there is no difference between its definition for
minification and magnification. First consider the 1-dimensional case.
Let T be a computed texture value (one of R_t, G_t, B_t, or A_t). Let
T[i] be the component value of the texel at location i in a 1-dimen‐
sional texture image. Then, if the appropriate texture filter mode is
FILTER4_SGIS, a 4-texel group is selected:
/ floor(u - 1/2) mod 2**n, TEXTURE_WRAP_S is REPEAT i1 = (
\ floor(u - 1/2), TEXTURE_WRAP_S is CLAMP
/ (i1 + 1) mod 2**n, TEXTURE_WRAP_S is REPEAT i2 = (
\ i1 + 1, TEXTURE_WRAP_S is CLAMP
/ (i1 + 2) mod 2**n, TEXTURE_WRAP_S is REPEAT i3 = (
\ i1 + 2, TEXTURE_WRAP_S is CLAMP
/ (i1 - 1) mod 2**n, TEXTURE_WRAP_S is REPEAT i0 = (
\ i1 - 1, TEXTURE_WRAP_S is CLAMP
Let f(x) be the filter weight function of positive distance x. Let
A = frac(u - 1/2)
where frac(x) denotes the fractional part of x, and u is the texture
image coordinate in the s direction, as illustrated in Figure 3.10 of
the GL Specification. Then the texture value T is found as
T = f(1+A) * T[i0] +
f(A) * T[i1] +
f(1-A) * T[i2] +
f(2-A) * T[i3]
If any of the selected T[i] in the above equation refer to a border
texel with unspecified value, then the border color given by the cur‐
rent setting of TEXTURE_BORDER_COLOR is used instead of the unspecified
value.
For 2-dimensional textures the calculations for i0, i1, i2, i3, and A
are identical to the 1-dimensional case. A 16-texel group is selected,
requiring four j values computed as
/ floor(v - 1/2) mod 2**m, TEXTURE_WRAP_T is REPEAT j1 = (
\ floor(v - 1/2), TEXTURE_WRAP_T is CLAMP
/ (j1 + 1) mod 2**m, TEXTURE_WRAP_T is REPEAT j2 = (
\ j1 + 1, TEXTURE_WRAP_T is CLAMP
/ (j1 + 2) mod 2**m, TEXTURE_WRAP_T is REPEAT j3 = (
\ j1 + 2, TEXTURE_WRAP_T is CLAMP
/ (j1 - 1) mod 2**m, TEXTURE_WRAP_T is REPEAT j0 = (
\ j1 - 1, TEXTURE_WRAP_T is CLAMP
Let B = frac(v - 1/2)
where v is the texture image coordinate in the t direction, as illus‐
trated in Figure 3.10 of the GL Specification. Then the texture value
T is found as
T = f(1+A) * f(1+B) * T[i0,j0] +
f(A) * f(1+B) * T[i1,j0] +
f(1-A) * f(1+B) * T[i2,j0] +
f(2-A) * f(1+B) * T[i3,j0] +
f(1+A) * f(B) * T[i0,j1] +
f(A) * f(B) * T[i1,j1] +
f(1-A) * f(B) * T[i2,j1] +
f(2-A) * f(B) * T[i3,j1] +
f(1+A) * f(1-B) * T[i0,j2] +
f(A) * f(1-B) * T[i1,j2] +
f(1-A) * f(1-B) * T[i2,j2] +
f(2-A) * f(1-B) * T[i3,j2] +
f(1+A) * f(2-B) * T[i0,j3] +
f(A) * f(2-B) * T[i1,j3] +
f(1-A) * f(2-B) * T[i2,j3] +
f(2-A) * f(2-B) * T[i3,j3]
If any of the selected T[i,j] in the above equation refer to a border
texel with unspecified value, then the border color given by the cur‐
rent setting of TEXTURE_BORDER_COLOR is used instead of the unspecified
value.
Filter4 texture filtering is currently undefined for 3-dimensional tex‐
tures.
Filter function
The default filter function is implementation dependent. The filter
function is specified in table format by calling TexFilterFuncSGIS with
<target> set to TEXTURE_1D or TEXTURE_2D, <filter> set to FILTER4_SGIS,
and <weights> pointing an array of <n> floating point values. The
value <n> must equal 2**m + 1 for some nonnegative integer value of m.
The array <weights> contains samples of the filter function f(x),
0<=x<=2. Each element <weights>[i] is the value of f((2*i)/(<n>-1)),
0<=i<=<n>-1.
The filter function is stored and used by GL as a set of samples
f((2*i)/(Size-1)), 0<=i<=Size-1, where Size is an implementation depen‐
dent constant. If <n> equals Size, the array <weights> is stored
directly in GL state. Otherwise, an implementation dependent resam‐
pling method is used to compute the stored samples.
Size must equal 2**m + 1 for some integer value of m greater than or
equal to 4. The value Size for texture <target> is returned by
<params> when GetTexParameteriv or GetTexParameterfv is called with
<pname> set to TEXTURE_FILTER4_SIZE_SGIS.
Minification vs. Magnification
If the magnification filter is given by FILTER4_SGIS, and the minifica‐
tion filter is given by NEAREST_MIPMAP_NEAREST or LINEAR_MIPMAP_NEAREST
, then c = 0.5. The parameter c is used to determine whether minifica‐
tion or magnification filtering is done, as described in Section 3.8.2
of the GL Specification (Texture Magnification).
The current contents of the Filter4 function table is queried using
glTexFilterfuncSGIS. <target> must be either GL_TEXTURE_1D or GL_TEX‐
TURE_2D.
ERRORS
GL_INVALID_ENUM is generated if glTexFilterFuncSGIS parameter <target>
is not GL_TEXTURE_1D or GL_TEXTURE_2D.
GL_INVALID_ENUM is generated if glTexFilterFuncSGIS or parameter <fil‐
ter> is not GL_FILTER4_SGIS.
GL_INVALID_VALUE is generated if glTexFilterFuncSGIS parameter <n> does
not equal 2**m + 1 for some nonnegative integer value of m.
GL_INVALID_OPERATION is generated if glTexFilterFuncSGIS or is executed
between execution of glBegin and the corresponding execution of glEnd.
ASSOCIATED CALLS
glGetTexfilterfuncSGIS.
SEE ALSO
glTexParameter
01 June 01 GLTEXFILTERFUNCSGIS(3GL)