Microsoft DirectX 9.0

D3DXFilterTexture Function

Filters mipmap levels of a texture.


HRESULT D3DXFilterTexture(      

    LPDIRECT3DBASETEXTURE9 pBaseTexture,     CONST PALETTEENTRY *pPalette,     UINT SrcLevel,     DWORD MipFilter );


[in] Pointer to an IDirect3DBaseTexture9 interface that represents the texture object to filter.
[out] Pointer to a PALETTEENTRY structure that represents a 256-color palette to fill in, or NULL for nonpalletized formats. If a palette is not specified, the default Microsoft?Direct3D?palette (an all opaque white palette) is provided. See Remarks.
[in] Level whose image is used to generate the subsequent levels. Specifying D3DX_DEFAULT for this parameter is equivalent to specifying 0.
[in] Combination of one or more D3DX_FILTER controlling how the mipmap is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_BOX if the texture size is a power of two, and D3DX_FILTER_BOX | D3DX_FILTER_DITHER otherwise.

Return Value

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be one of the following values.

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.
D3DXERR_INVALIDDATAThe data is invalid.


A box filter is recursively applied to each texture level to generate the next texture level.

Writing to a non-level-zero surface of the texture will not cause the dirty rectangle to be updated. If D3DXFilterTexture is called and the surface was not already dirty (this is unlikely under normal usage scenarios), the application needs to explicitly call IDirect3DTexture9::AddDirtyRect on the texture.

Textures created in the default pool (D3DPOOL_DEFAULT) cannot be used with D3DXFilterTexture because a lock operation is needed on the object. Note that locks are prohibited on textures in the default pool.

For details on PALETTEENTRY, see the Microsoft Platform Software Development Kit (SDK). Note that as of Microsoft DirectX?8.0, the peFlags member of the PALETTEENTRY structure does not function as documented in the Platform SDK. The peFlags member is now the alpha channel for 8-bit palletized formats.

There is only one texture filtering function, but two macros that call this method.

#define D3DXFilterCubeTexture D3DXFilterTexture
#define D3DXFilterVolumeTexture D3DXFilterTexture

Function Information

Import libraryd3dx9.lib
Minimum operating systems Windows 98

© 2002 Microsoft Corporation. All rights reserved.