Expand Minimize

D3DXFillVolumeTexture function

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

Syntax


HRESULT D3DXFillVolumeTexture(
  _Out_  LPDIRECT3DVOLUMETEXTURE9 pTexture,
  _In_   LPD3DXFILL3D pFunction,
  _In_   LPVOID pData
);

Parameters

pTexture [out]

Type: LPDIRECT3DVOLUMETEXTURE9

Pointer to an IDirect3DVolumeTexture9 interface, representing the filled texture.

pFunction [in]

Type: LPD3DXFILL3D

Pointer to a user-provided evaluator function, which will be used to compute the value of each texel. The function follows the prototype of LPD3DXFILL3D.

pData [in]

Type: LPVOID

Pointer to an arbitrary block of user-defined data. This pointer will be passed to the function provided in pFunction.

Return value

Type: HRESULT

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_INVALIDCALL.

Remarks

If the volume is non-dynamic (because usage is set to 0 when it is created), and located in video memory (the memory pool set to D3DPOOL_DEFAULT), D3DXFillVolumeTexture will fail because the volume cannot be locked.

This example creates a function called ColorVolumeFill, 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);
}
    
    
// Fill volume texture
if (FAILED (hr = D3DXFillVolumeTexture (m_pTexture, ColorVolumeFill, NULL)))
{
       return hr;
}


Requirements

Header

D3dx9tex.h

Library

D3dx9.lib

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.