| Microsoft DirectX 8.1 (Visual Basic) |
Microsoft® Direct3D® enables one shading mode to be selected at a time. By default, Gouraud shading is selected. In Microsoft Visual Basic®, you can change the shading mode by calling the Direct3DDevice8.SetRenderState method. Set the State parameter to D3DRS_SHADEMODE. The State parameter must be set to a member of the CONST_D3DSHADEMODE enumeration. The following code example illustrates how the current shading mode of a Direct3D application can be set to flat or Gouraud shading mode.
' Set to flat shading.
' This code example assumes that d3dDev is a valid reference to
' a Direct3DDevice8 object.
On Local Error Resume Next
Call d3dDev.SetRenderState(D3DRS_SHADEMODE, _
D3DSHADE_FLAT)
' Check for an error.
If Err.Number <> D3D_OK Then
' Handle the error.
End If
' Set to Gouraud shading. this is the default for Direct3D.
Call d3dDev.SetRenderState(D3DRS_SHADEMODE, _
D3DSHADE_GOURAUD)
If Err.Number <> D3D_OK Then
' Handle the error.
End If