SpriteBatch.Begin Method (SpriteBlendMode, SpriteSortMode, SaveStateMode)

Prepares the graphics device for drawing sprites with specified blending, sorting, and render state options.

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

public void Begin (
         SpriteBlendMode blendMode,
         SpriteSortMode sortMode,
         SaveStateMode stateMode


Blending options to use when rendering.
Sorting options to use when rendering.
Rendering state options.

Exception typeCondition
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.

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:

Begin sets the following sampler states:

If Begin is called with SaveStateMode set to None, the caller must reset these states must be reset if they are used elsewhere. Calling Begin with SaveStateMode set to SaveState will reset these values properly, but performance may be adversely affected.

Xbox 360, Windows XP SP2, Windows Vista

Community Additions