Microsoft DirectX 9.0

D3DXFillVolumeTexture Function

Uses a user-provided function to fill each texel of each mip level of a given volume texture.


HRESULT D3DXFillVolumeTexture(      

    LPDIRECT3DVOLUMETEXTURE9 pTexture,     LPD3DXFILL3D pFunction,     LPVOID pData );


[out, retval] Pointer to an IDirect3DVolumeTexture9 interface, representing the filled texture.
[in] Pointer to a user-provided evaluator function, which will be used to compute the value of each texel. The function follows the prototype of LPD3DFILL3D.
[in] Pointer to an arbitrary block of user-defined data. This pointer will be passed to the function provided in pFunction.

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.


If the volume is nondynamic (because of a usage parameter set to 0 at the creation) and located in video memory (the memory pool set to D3DPOOL_DEFAULT), D3DXFillVolumeTexture will fail because Direct3D extensions (D3DX) cannot lock nondynamic volumes located in video memory.

Here is an example that creates a function called ColorCubeFill, which relies on D3DXFillVolumeTexture.

// Define a function that matches the prototype of LPD3DXFILL3D
VOID WINAPI ColorVolumeFill (D3DXVECTOR4* pOut, const D3DXVECTOR3* pTexCoord, 
const D3DXVECTOR3* pTexelSize, LPVOID pData)
   *pOut = D3DXVECTOR4(pTexCoord->x, pTexCoord->y, pTexCoord->z, 0.0f);

// Create volume texture using D3DXFillVolumeTexture
if (FAILED (hr = D3DXFillVolumeTexture (m_pTexture, ColorVolumeFill, NULL)))
       return hr;

Function Information

Import libraryd3dx9.lib
Minimum operating systems Windows 98

© 2002 Microsoft Corporation. All rights reserved.