Table of Contents

Class Effect

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

Used to set and query shader effects, and to choose techniques.

public class Effect : GraphicsResource, IDisposable
Inheritance
Effect
Implements
Derived
Inherited Members

Constructors

Effect(Effect)

Creates a clone of the Effect.

protected Effect(Effect cloneSource)

Parameters

cloneSource Effect

Effect to clone.

Effect(GraphicsDevice, byte[])

Creates a new instance of Effect.

public Effect(GraphicsDevice graphicsDevice, byte[] effectCode)

Parameters

graphicsDevice GraphicsDevice

Graphics device

effectCode byte[]

The effect code.

Exceptions

ArgumentException

This effectCode is invalid.

Effect(GraphicsDevice, byte[], int, int)

Creates a new instance of Effect.

public Effect(GraphicsDevice graphicsDevice, byte[] effectCode, int index, int count)

Parameters

graphicsDevice GraphicsDevice

Graphics device

effectCode byte[]

The effect code.

index int
count int

Exceptions

ArgumentException

This effectCode is invalid.

Properties

CurrentTechnique

Gets or sets the active technique.

public EffectTechnique CurrentTechnique { get; set; }

Property Value

EffectTechnique

Remarks

If there are multiple techiques in an effect and you want to use a new technique in the next pass, you must set CurrentTechnique to the new technique before making the rendering pass.

Parameters

Gets a collection of shader parameters used for this effect.

public EffectParameterCollection Parameters { get; }

Property Value

EffectParameterCollection

Techniques

Gets a collection of shader techniques that are defined for this effect.

public EffectTechniqueCollection Techniques { get; }

Property Value

EffectTechniqueCollection

Methods

Clone()

Returns a deep copy of the effect where immutable types are shared and mutable data is duplicated.

public virtual Effect Clone()

Returns

Effect

The cloned effect.

Remarks

Dispose(bool)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

GraphicsDeviceResetting()

The GraphicsDevice is resetting, so GPU resources must be recreated.

protected override void GraphicsDeviceResetting()

OnApply()

Applies the effect state just prior to rendering the effect.

protected virtual void OnApply()