Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 6: Advanced Techniques > Advanced Sprite Batch Techniques

Advanced Sprite Batch Techniques

On the Zune, all drawing is done via sprite batches. The lack of a dedicated graphics processing unit (GPU) on the Zune rules out the possibility of drawing 3D models or using shaders. And there are no 2D drawing primitives, such as lines, triangles, quads, circles, and so on. So, it's very important and useful to understand how sprite batches work.

How Sprite Batches Work

A sprite batch is a way of grouping several drawing operations into one singular unit. Rather than drawing each individual sprite or string to the graphics device one-by-one, Draw calls to the same sprite batch will be sent as a condensed group to the graphics device.

A sprite batch is started via a call to spriteBatch.Begin(blendMode), where blendMode specifies one of the blend modes discussed in the next section. After the sprite batch has begun, subsequent Draw calls are attached to the SpriteBatch object. It's not until spriteBatch.End() is called that the graphics data is actually sent to be displayed by the device.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial