Texture Stages Using Alpha

[Previous] [Next]

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:

  • D3DTSS_ALPHAOP A texture alpha-blending operation, identified by one of the members of the D3DTEXTUREOP enumerated type. The default value for the first texture stage (stage 0) is D3DTOP_SELECTARG1. For all other stages, the default is D3DTOP_DISABLE.
  • D3DTSS_ALPHAARG1 The first alpha argument for the stage, identified by a texture argument flag. The default argument is D3DTA_TEXTURE. If no texture is set for this stage, the default argument is D3DTA_DIFFUSE.
  • D3DTSS_ALPHAARG2 The second alpha argument for the stage, identified by a texture argument flag. The default argument is D3DTA_CURRENT.

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 ); 



Inside Direct3D
Inside Direct3D (Dv-Mps Inside)
ISBN: 0735606137
EAN: 2147483647
Year: 1999
Pages: 131

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net