As you saw in Chapter 8, the IDirect3D7 and IDirect3DDevice7 interfaces allow you to blend up to eight textures onto primitives in a single pass. The texture stages that use alpha are basically the same as the texture stages described in Chapter 8—except, obviously, that they handle alpha information. For alpha operations, you use the D3DTSS_ALPHAOP stage state (which is similar to the color channel you learned about in Chapter 8), which in turn uses values from the D3DTEXTUREOP enumerated type.
The following texture-blending stages pertain to alpha blending:
The following code segment illustrates the use of these three states together:
m_pd3dDevice->SetTextureStageState( i, D3DTSS_ALPHAOP, op); m_pd3dDevice->SetTextureStageState( i, D3DTSS_ALPHAARG1, arg1 ); m_pd3dDevice->SetTextureStageState( i, D3DTSS_ALPHAARG2, arg2 ); |