Microsoft DirectX 9.0 SDK Update (October 2004)

Material Alpha

Language:

Note: This documentation is preliminary and is subject to change.

Alpha data also can be supplied in a material. To enable material alpha, set the diffuse material render state so that the runtime uses the material diffuse color components rather than the vertex diffuse color components, as shown in the following C# code.

          [C#]
          
// Enable material alpha. device.RenderState.DiffuseMaterialSource = ColorSource.Material;

The following C# code initializes the material with an alpha value, and sets the material before drawing.

          [C#]
          
Material mtrl = new Material(); Color c = Color.FromArgb(127, 255, 0, 0); mtrl.Diffuse = c; mtrl.Ambient = c; mtrl.Specular = c; mtrl.Emissive = c; device.Material = mtrl;

© 2004 Microsoft Corporation. All rights reserved. Terms of use.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center