Per-Vertex Color State
A version of this page is also available for
4/8/2010
When using flexible vertex format (FVF) codes, vertices can contain both vertex color and vertex normal information. By default, Microsoft® Direct3D® Mobile uses this information when it calculates lighting. To disable use of vertex color lighting information, invoke the IDirect3DMobileDevice::SetRenderState method and pass D3DMRS_COLORVERTEX (see D3DMRENDERSTATETYPE) as the first parameter. Set the second parameter to FALSE to disable vertex color lighting, or TRUE 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 D3DMRS_AMBIENTMATERIALSOURCE, D3DMRS_DIFFUSEMATERIALSOURCE, and D3DRS_SPECULARMATERIALSOURCE render states control the ambient, diffuse, and specular color component sources, respectively. Each state can be set to members of the D3DMMATERIALCOLORSOURCE enumerated type, 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.