SpriteBatch.Begin Method ()
Prepares the graphics device for drawing sprites.
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
Syntax
public void Begin ()
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 SpriteBlendMode to AlphaBlend, 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