Effect Constructor (GraphicsDevice, String, CompilerOptions, EffectPool)
Initializes a new instance of this class from a compiled effect, specifying the compiled effect by file name.
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
Syntax
public Effect (
GraphicsDevice graphicsDevice,
string effectCodeFile,
CompilerOptions options,
EffectPool pool
)
Parameters
- graphicsDevice
The graphics device that will create the effect. - effectCodeFile
A file containing a compiled byte code. - options
Compilation optimization options. - pool
Specifies a pool of resources to share between effects.
Exceptions
Exception type | Condition |
---|---|
ArgumentNullException | graphicsDevice is null. The graphics device must not be null when creating new resources. |
ObjectDisposedException | Effect was called after pool was disposed. |
InvalidOperationException |
|
Tip
In most cases, it is preferrable to initialize a new instance of an effect using the ContentManager.Load<Effect> method rather than using the Effect constructors. For an example of initializing an effect with this method, please see How to: Create and Apply Custom Effects.
Remarks
Obtaining the compiled byte code for effectCodeFile is a two-part process. First, the effect must be compiled using the static methods Effect.CompileEffectFromFile or Effect.CompileEffectFromSource, which returns an instance of CompiledEffect. CompiledEffect.GetEffectCode returns the compiled byte code from the compiled effect.
See Also
Tasks
How to: Create and Apply Custom Effects
Reference
Effect.CompileEffectFromFile Method
Effect.CompileEffectFromSource Method
Effect Class
Effect Members
Microsoft.Xna.Framework.Graphics Namespace
Platforms
Xbox 360, Windows XP SP2, Windows Vista