Скачиваний:
47
Добавлен:
17.03.2015
Размер:
2.46 Mб
Скачать

3.8. TEXTURING

189

If the value of TEXTURE MAG FILTER is not NEAREST, or the value of

TEXTURE MIN FILTER is not NEAREST or NEAREST MIPMAP NEAREST, then r may be computed by comparing more than one depth texture value to the texture R coordinate. The details of this are implementation-dependent, but r should be a value in the range [0, 1] which is proportional to the number of comparison passes or failures.

3.8.15 Texture Application

Texturing is enabled or disabled using the generic Enable and Disable commands, respectively, with the symbolic constants TEXTURE 1D, TEXTURE 2D, TEXTURE 3D, or TEXTURE CUBE MAP to enable the one-, two-, three-dimensional, or cube map texture, respectively. If both twoand one-dimensional textures are enabled, the two-dimensional texture is used. If the three-dimensional and either of the twoor one-dimensional textures is enabled, the three-dimensional texture is used. If the cube map texture and any of the three-, two-, or one-dimensional textures is enabled, then cube map texturing is used. If all texturing is disabled, a rasterized fragment is passed on unaltered to the next stage of the GL (although its texture coordinates may be discarded). Otherwise, a texture value is found according to the parameter values of the currently bound texture image of the appropriate dimensionality using the rules given in sections 3.8.6 through 3.8.9. This texture value is used along with the incoming fragment in computing the texture function indicated by the currently bound texture environment. The result of this function replaces the incoming fragment’s primary R, G, B, and A values. These are the color values passed to subsequent operations. Other data associated with the incoming fragment remain unchanged, except that the texture coordinates may be discarded.

Each texture unit is enabled and bound to texture objects independently from the other texture units. Each texture unit follows the precedence rules for one-, two- , three-dimensional, and cube map textures. Thus texture units can be performing texture mapping of different dimensionalities simultaneously. Each unit has its own enable and binding states.

Each texture unit is paired with an environment function, as shown in figure 3.11. The second texture function is computed using the texture value from the second texture, the fragment resulting from the first texture function computation and the second texture unit’s environment function. If there is a third texture, the fragment resulting from the second texture function is combined with the third texture value using the third texture unit’s environment function and so on. The texture unit selected by ActiveTexture determines which texture unit’s environment is modified by TexEnv calls.

Version 2.0 - October 22, 2004

3.8. TEXTURING

190

Cf

CT0

 

 

TE0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

TE

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CT1

 

 

 

 

 

 

 

 

TE

2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CT2

 

 

 

 

 

 

 

 

 

 

 

 

TE3

 

C’f

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CT3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Cf

= fragment primary color input to texturing

 

 

 

 

C’f

= fragment color output from texturing

 

 

CTi = texture color from texture lookup i

TEi = texture environment i

Figure 3.11. Multitexture pipeline. Four texture units are shown; however, multitexturing may support a different number of units depending on the implementation. The input fragment color is successively combined with each texture according to the state of the corresponding texture environment, and the resulting fragment color passed as input to the next texture unit in the pipeline.

If the value of TEXTURE ENV MODE is COMBINE, the texture function associated with a given texture unit is computed using the values specified by SRCn RGB,

SRCn ALPHA, OPERANDn RGB and OPERANDn ALPHA. If TEXTUREn is specified as

SRCn RGB or SRCn ALPHA, the texture value from texture unit n will be used in computing the texture function for this texture unit.

Texturing is enabled and disabled individually for each texture unit. If texturing is disabled for one of the units, then the fragment resulting from the previous unit is passed unaltered to the following unit. Individual texture units beyond those specified by MAX TEXTURE UNITS are always treated as disabled.

If a texture unit is disabled or has an invalid or incomplete texture (as defined in section 3.8.10) bound to it, then blending is disabled for that texture unit. If the texture environment for a given enabled texture unit references a disabled texture unit, or an invalid or incomplete texture that is bound to another unit, then the

Version 2.0 - October 22, 2004

Соседние файлы в папке OpenGL