Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
EffectTechnique Class
Collapse the table of content
Expand the table of content

EffectTechnique Class

Represents an effect technique.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.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 XP SP2, Windows Vista

Community Additions

ADD
Show:
© 2015 Microsoft