SpriteBatch.Begin Method (SpriteBlendMode)
Prepares the graphics device for drawing sprites with specified blending options.
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
Syntax
public void Begin (
SpriteBlendMode blendMode
)
Parameters
- blendMode
Blending options to use when rendering.
Exceptions
Exception type | Condition |
---|---|
InvalidOperationException | Begin has been called before calling End after the last call to Begin. Begin cannot be called again until End has been successfully called. |
Remarks
This method must be called before any calls to Draw. When all the sprites have been drawn, call End.
Begin sets the following render states:
- CullMode
- DepthBufferEnable
- AlphaBlendEnable
- AlphaTestEnable
- AlphaBlendOperation
- SourceBlend
- DestinationBlend
- SeparateAlphaBlendEnabled
- AlphaFunction
- ReferenceAlpha
Begin sets the following sampler states:
This version of Begin sets SpriteSortMode to Deferred, and SaveStateMode to None. When SaveStateMode is set to None, the caller must reset the render and sampler states if they are used elsewhere.
See Also
Tasks
Concepts
Reference
SpriteBatch Class
SpriteBatch Members
Microsoft.Xna.Framework.Graphics Namespace
Platforms
Xbox 360, Windows XP SP2, Windows Vista