NOTE: The ID3DXPMesh and ID3DXSPMesh interfaces are now obsolete and will be removed in a future release.


Sets the current level of detail to as close to the specified number of faces as possible.

HRESULT SetNumFaces(
  DWORD Faces


[in] Target number of faces. This value specifies the desired change in the level of detail (LOD).

Return Values

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL.


If the number of faces is greater than the maximum number of faces, it is capped at the maximum number of faces returned by ID3DXPMesh::GetMaxFaces. If the number of faces is less than the minimum number of faces, it is capped at the minimum number of faces returned by ID3DXPMesh::GetMinFaces.

The number of faces after this call may be off by one because some edge collapse may introduce or remove one face or two. For example, if you try setting the number of faces to an intermediate value such as 5, when 4 and 6 are possible, 4 will always be the result.


Header: Declared in D3DX9Mesh.h.

Library: Use D3dx9.lib.