Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

D3DXFillTextureTX function

Uses a compiled high-level shader language (HLSL) function to fill each texel of each mipmap level of a texture.

Syntax


HRESULT D3DXFillTextureTX(
  _Inout_ LPDIRECT3DTEXTURE9  pTexture,
  _In_    LPD3DXTEXTURESHADER pTextureShader
);

Parameters

pTexture [in, out]

Type: LPDIRECT3DTEXTURE9

Pointer to an IDirect3DTexture9 object, representing the texture to be filled.

pTextureShader [in]

Type: LPD3DXTEXTURESHADER

Pointer to a ID3DXTextureShader texture shader object.

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: D3DERR_NOTAVAILABLE, D3DERR_INVALIDCALL.

Remarks

The texture target must be an HLSL function that takes contains the following semantics:

  • One input parameter must use a POSITION semantic.
  • One input parameter must use a PSIZE semantic.
  • The function must return a parameter that uses the COLOR semantic.

The following is an example of such an HLSL function:



float4 TextureGradientFill(
  float2 vTexCoord : POSITION, 
  float2 vTexelSize : PSIZE) : COLOR 
  {
    float r,g, b, xSq,ySq, a;
    xSq = 2.f*vTexCoord.x-1.f; xSq *= xSq;
    ySq = 2.f*vTexCoord.y-1.f; ySq *= ySq;
    a = sqrt(xSq+ySq);
    if (a > 1.0f) {
        a = 1.0f-(a-1.0f);
    }
    else if (a < 0.2f) {
        a = 0.2f;
    }
    r = 1-vTexCoord.x;
    g = 1-vTexCoord.y;
    b = vTexCoord.x;
    return float4(r, g, b, a);
    
  };


Note that the input parameters can be in any order, but both input semantics must be represented.

Requirements

Header

D3dx9tex.h

Library

D3dx9.lib

See also

D3DXFillCubeTextureTX
D3DXFillVolumeTextureTX

 

 

Community Additions

ADD
Show:
© 2015 Microsoft