次の方法で共有


Effect Constructor (GraphicsDevice, Effect)

Initializes a new instance of this class, specifying the graphics device to associate with this effect and the effect to clone.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

protected Effect (
         GraphicsDevice graphicsDevice,
         Effect cloneSource
)

Parameters

  • graphicsDevice
    The graphics device that will create the effect.
  • cloneSource
    The effect to clone.

Exceptions

Exception type Condition
ArgumentNullException cloneSource or graphicsDevice is null.
InvalidOperationException Unable to create the effect resource on the graphics device.
ObjectDisposedException Effect was called after cloneSource was disposed.

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 by using this method, see How to: Create and Apply Custom Effects.

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