Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SpriteBatch.Begin Method (SpriteSortMode, BlendState, SamplerState, DepthStencilState, RasterizerState, Effect, Matrix)

Begins a sprite batch operation using the specified sort, blend, sampler, depth stencil, rasterizer state objects, plus a custom effect and a 2D transformation matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default SpriteBatch Class shader.

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

public void Begin (
         SpriteSortMode sortMode,
         BlendState blendState,
         SamplerState samplerState,
         DepthStencilState depthStencilState,
         RasterizerState rasterizerState,
         Effect effect,
         Matrix transformMatrix


Type: SpriteSortMode
Sprite drawing order.
Type: BlendState
Blending options.
Type: SamplerState
Texture sampling options.
Type: DepthStencilState
Depth and stencil options.
Type: RasterizerState
Rasterization options.
Type: Effect
Effect state options.
Type: Matrix
Transformation matrix for scale, rotate, translate 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.

Xbox 360, Windows 7, Windows Vista, Windows XP

Community Additions

© 2015 Microsoft