Microsoft DirectX 8.1 (Visual Basic)

Per-Vertex Color State

The following vertex types cannot contain both color and normal information.

Because the default shading mode is Gouraud shading, which depends on both vertex color and normal information, Microsoft® Direct3D® does not use vertex color in lighting calculations involving the predefined vertex types.

However, when you use flexible vertex format (FVF) codes, vertices can contain both vertex color and vertex normal information. By default, Direct3D uses this information when it calculates lighting. To disable use of vertex color lighting information, invoke the Direct3DDevice8.SetRenderState method and pass D3DRS_COLORVERTEX as the first parameter. Set the second parameter to 0 to disable vertex color lighting, or 1 to enable it.

If per-vertex color is enabled, applications can configure the source from which the system retrieves color information for a vertex. The D3DRS_AMBIENTMATERIALSOURCE, D3DRS_DIFFUSEMATERIALSOURCE, D3DRS_EMISSIVEMATERIALSOURCE, and D3DRS_SPECULARMATERIALSOURCE render states control the ambient, diffuse, emissive, and specular color component sources, respectively. Each state can be set to members of the CONST_D3DMATERIALCOLORSOURCE enumeration, which defines constants that instruct the system to use the current material, diffuse color, or specular color as the source for the specified color component.