Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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)
    {
        MyEffect.mWorld.SetValue(terrainWorld);
        MyEffect.MeshTexture.SetValue(terrainTex);
        foreach (ModelMesh mesh in terrain.Meshes)
        {
            foreach (Effect effect in mesh.Effects)
            {
                effect.CurrentTechnique = technique;
                mesh.Draw();
            }
        }
    }
    

Xbox 360, Windows 7, Windows Vista, Windows XP

Community Additions

Show:
© 2014 Microsoft