DirectX SDK

Shading State

[C++]

Direct3D supports both flat and Gouraud shading. The default is Gouraud shading. To control the current shading mode, your C++ application uses the D3DSHADEMODE enumerated type. See D3DRENDERSTATE_SHADEMODE.

The following C++ code fragment demonstrates the process of setting the shading state to flat shading mode:

// This code fragment assumes that lpD3DDevice is a valid pointer to
// a IDirect3DDevice7 interface.
 
// Set the shading state.
lpD3DDevice->SetRenderState(D3DRENDERSTATE_SHADEMODE, 
                            D3DSHADE_FLAT);
[Visual Basic]

Direct3D supports both flat and Gouraud shading. The default is Gouraud shading. To control the current shading mode from a Visual Basic application, use the CONST_D3DSHADEMODE enumerated type. See D3DRENDERSTATE_SHADEMODE.

The following Visual Basic code fragment demonstrates the process of setting the shading state to flat shading mode:

' This example assumes that D3DDevice is a valid reference 
' to a Direct3DDevice7 object.
 
' Set the shading state.
Call D3DDevice.SetRenderState(D3DRENDERSTATE_SHADEMODE, D3DSHADE_FLAT)