Render Mesh with Texture using HLSL
This example demonstrates how to render a mesh texture using the high-level shader language (HLSL).
In the following C# code example, the following assumptions are made:
- effect is a valid HLSL Effect with its technique set.
- The code occurs between calls to Effect.BeginPass and Effect.EndPass.
- mesh is a valid Mesh.
- meshTextures is a valid array of textures for the mesh.
[C#]
effect.SetValue("WorldViewProjection", worldMatrix);
// Iterate through each subset and render with its texture
for (int m = 0; m < meshTextures.Length; ++m)
{
effect.SetValue("SceneTexture", meshTextures[m]));
effect.CommitChanges();
mesh.DrawSubset(m);
}