Skip to content

Latest commit

 

History

History
35 lines (22 loc) · 1.35 KB

per-vertex-color-state.md

File metadata and controls

35 lines (22 loc) · 1.35 KB
description ms.assetid title ms.topic ms.date
The Direct3D lighting engine can use per-vertex color data when performing lighting if you tell the runtime the data is present.
acb43921-f0d4-4151-9371-1b99e5d30c0e
Per-Vertex Color State (Direct3D 9)
article
05/31/2018

Per-Vertex Color State (Direct3D 9)

The Direct3D lighting engine can use per-vertex color data when performing lighting if you tell the runtime the data is present. This is done by turning on the following render state:

// disable per-vertex color
SetRenderState(D3DRS_COLORVERTEX, FALSE);

// enable per-vertex color
SetRenderState(D3DRS_COLORVERTEX, TRUE);

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 D3DMATERIALCOLORSOURCE 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.

Related topics

Render States