DirectX SDK

Texture Blending Operations and Arguments

Applications associate a blending stage with each texture in the set of current textures. As mentioned in Texture Stages and the Texture Blending Cascade, Direct3D evaluates each blending stage in order, beginning with the first texture in the set and ending with the eighth.

[C++]

Direct3D applies the information from each texture in the set of current textures to the blending stage that is associated with it. Applications control what information from a given texture stage is used by calling IDirect3DDevice7::SetTextureStageState. You can set separate operations for the color and alpha channels independently, and each operation uses two arguments. Specify color channel operations by using the D3DTSS_COLOROP stage state, and D3DTSS_ALPHAOP for alpha operations–both use values from the D3DTEXTUREOP enumerated type.

Texture blending arguments use the D3DTSS_COLORARG1, D3DTSS_COLORARG2, D3DTSS_ALPHARG1, and D3DTSS_ALPHARG2 members of the D3DTEXTURESTAGESTATETYPE enumerated type. The corresponding argument values are identified using texture argument flags.

Note  You can disable a texture stage—and any subsequent texture blending stages in the cascade—by setting the color operation for that stage to D3DTOP_DISABLE. Disabling the color operation effectively disables the alpha operation as well. Alpha operations cannot be disabled when color operations are enabled. Setting the alpha operation to D3DTOP_DISABLE when color blending is enabled causes undefined behavior.

[Visual Basic]

Direct3D applies the information from each texture in the set of current textures to the blending stage that is associated with it. Applications control what information from a given texture stage is used by calling Direct3DDevice7.SetTextureStageState. You can set separate operations for the color and alpha channels independently, and each operation uses two arguments. Specify color channel operations by using the D3DTSS_COLOROP stage state, and D3DTSS_ALPHAOP for alpha operations–both use values from the CONST_D3DTEXTUREOP enumeration.

Texture blending arguments use the D3DTSS_COLORARG1, D3DTSS_COLORARG2, D3DTSS_ALPHARG1, and D3DTSS_ALPHARG2 members of the CONST_D3DTEXTURESTAGESTATETYPE enumeration. The corresponding argument values are identified using texture argument flags.

Note  You can disable a texture stage—and any subsequent texture blending stages in the cascade—by setting the color operation for that stage to D3DTOP_DISABLE. Disabling the color operation effectively disables the alpha operation as well. Alpha operations cannot be disabled when color operations are enabled. Setting the alpha operation to D3DTOP_DISABLE when color blending is enabled causes undefined behavior.