TEXTURE_MIN_FILTER values NEAREST_MIPMAP_NEAREST,
NEAREST_MIPMAP_LINEAR, LINEAR_MIPMAP_NEAREST,
and LINEAR_MIPMAP_LINEAR
each require the use of a mipmap.
A mipmap is an ordered set of arrays representing the same image;
each array has a resolution lower than the previous one.
If the texture has dimensions ,
then there are
mipmap arrays.
The first array is the original texture with dimensions
.
Each subsequent array has dimensions
where
are the dimensions of the previous array.
This is the case as long as both k>0 and l>0.
Once either k=0 or l=0,
each subsequent array has dimension
or
,
respectively,
until the last array is reached with dimension
.
Each array in a mipmap is transmitted to the GL using TexImage2D
or TexImage1D ;
the array being set is indicated with the level-of-detail
argument.
Level-of-detail numbers proceed from 0 for the original
texture array through with each unit increase indicating
an array of half the dimensions of the previous one as already described.
If texturing is enabled
(and TEXTURE_MIN_FILTER is one that requires a mipmap)
at the time a primitive is rasterized and if
the set of arrays 0 through p is incomplete,
based on the dimensions of array 0,
then it is as if texture mapping were disabled.
The set of arrays 0 through p is incomplete if
the internal formats of all the mipmap arrays were not specified with the
same symbolic constant,
or if the border widths of the mipmap arrays are not the same,
or if the dimensions of the mipmap arrays do not follow the sequence
described above.
Arrays indexed greater than p are insignificant.
The mipmap is used in conjunction with the level of detail to approximate
the application of an appropriately filtered texture to a fragment.
Let and let c be the value of
at which the transition
from minification to magnification occurs (since this discussion pertains to
minification,
we are concerned only with values of
where
).
For NEAREST_MIPMAP_NEAREST,
if
then the mipmap array with level-of-detail of 0
is selected.
Otherwise,
the dth mipmap array is selected
when
as long as
.
If
,
then the pth mipmap array is selected.
The rules for NEAREST are then applied to the selected array.
The same mipmap array selection rules apply for LINEAR_MIPMAP_NEAREST as for NEAREST_MIPMAP_NEAREST, but the rules for LINEAR are applied to the selected array.
For NEAREST_MIPMAP_LINEAR,
the level d-1 and the level d mipmap arrays are selected,
where ,
unless
, in which case the pth mipmap
array is used for both arrays.
The rules for NEAREST are then applied to each of these arrays,
yielding two corresponding texture values
and
.
The final texture value is then found as
LINEAR_MIPMAP_LINEAR
has the same effect as NEAREST_MIPMAP_LINEAR
except that the rules for LINEAR are applied for each of the
two mipmap arrays to generate and
.