DirectX SDK

Culling State

As Direct3D renders primitives, it culls those primitives that are facing away from the viewer.

[C++]

You can set the culling mode from a C++ application by using the D3DCULL enumerated type. See D3DRENDERSTATE_CULLMODE. By default, Direct3D culls back faces with counterclockwise vertices.

The following code sample illustrates the process of setting the culling mode to cull back faces with clockwise vertices.

// This code fragment assumes that lpD3DDevice is a valid pointer to
// an IDirect3DDevice interface.
 
// Set the culling state.
lpD3DDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 
                            D3DCULL_CW);
[Visual Basic]

Visual Basic applications set the culling mode by using D3DRENDERSTATE_CULLMODE render state, which can be set to a member of the CONST_D3DCULL enumeration. By default, Direct3D culls back faces with counterclockwise vertices.

The following code sample illustrates the process of setting the culling mode to cull back faces with clockwise vertices.

' This code fragment assumes that D3DDevice  contains a valid 
' reference to a Direct3DDevice object.
 
' Set the culling state.
Call D3DDevice.SetRenderState(D3DRENDERSTATE_CULLMODE, _ 
                              D3DCULL_CW)