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

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, Windows Phone 7

Community Additions

ADD
Show:
© 2015 Microsoft