Table of Contents

Class EffectTechnique

Namespace
Microsoft.Xna.Framework.Graphics
Assembly
MonoGame.Framework.dll

Represents a technique used in a shader effect.

public class EffectTechnique
Inheritance
EffectTechnique
Inherited Members

Examples

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

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

texture = effect.Techniques["TextureRender"];
shadowMap = effect.Techniques["ShadowMapRender"];
shadows = effect.Techniques["ShadowRender"];
  1. 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();
       }
   }
}

Remarks

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

Properties

Annotations

Gets the EffectAnnotation objects associated with this technique.

public EffectAnnotationCollection Annotations { get; }

Property Value

EffectAnnotationCollection

Name

Gets the name of this technique.

public string Name { get; }

Property Value

string

Passes

Gets the collection of EffectPass objects this rendering technique requires.

public EffectPassCollection Passes { get; }

Property Value

EffectPassCollection