EffectTechnique Class

Represents an effect technique.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework.Graphics (in microsoft.xna.framework.graphics.dll)

public sealed class EffectTechnique

Creating and assigning a EffectTechnique instance for each technique in your Effect is significantly faster than using the Techniques indexed property on Effect.

To use a EffectTechnique you must:

  1. Create a EffectTechnique for each technique in your Effect.

    public EffectTechnique texture;
    public EffectTechnique shadows;
    public EffectTechnique shadowMap;
  2. Assign an Effect technique to your EffectTechnique.

    texture = effect.Techniques["TextureRender"];
    shadowMap = effect.Techniques["ShadowMapRender"];
    shadows = effect.Techniques["ShadowRender"];
  3. Assign your EffectTechnique to the CurrentTechnique of your Effect before drawing.

    private void DrawScene(EffectTechnique technique)
        foreach (ModelMesh mesh in terrain.Meshes)
            foreach (Effect effect in mesh.Effects)
                effect.CurrentTechnique = technique;

Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone 7

Community Additions