TextureLoader.FillTexture Method

Language:

Uses a user-provided function or a compiled high-level shader language (HLSL) function to fill each texel of each mip level of a given texture.

Definition

Visual Basic Public Shared Sub FillTexture( _
    ByVal texture As CubeTexture, _
    ByVal callbackFunction As Fill3DTextureCallback _
)
C# public static void FillTexture(
    CubeTexture texture,
    Fill3DTextureCallback callbackFunction
);
C++ public:
static void FillTexture(
    CubeTexturetexture,
    Fill3DTextureCallbackcallbackFunction
);
JScript public static function FillTexture(
    texture : CubeTexture,
    callbackFunction : Fill3DTextureCallback
);

Parameters

texture Microsoft.DirectX.Direct3D.CubeTexture
A CubeTexture object that represents the filled texture.
callbackFunction Microsoft.DirectX.Direct3D.Fill3DTextureCallback
User-provided Fill3DTextureCallback delegate that is used to compute the value of each texel.

Remarks

If the param_GraphicsStream_compiledCode parameter is used, the HLSL function must contain the following semantics:

The following is a C# code example of such an HLSL function:

[C#]
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.

Exceptions
InvalidCallException The method call is invalid. For example, a method's parameter might contain an invalid value.
NotAvailableException This device does not support the queried technique.


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.