Background Reference Material

Well specific questions in general are easier to answer then broad ones.

Take for example when asking about what happens when you draw a sprite with spritebatch.

Consider these 3 classes.

You will notice item.Set{ … }

Looking back to that Original draw method you will notice FlushIfNeeded which relates to a batch of items.

You can look around further into that class to see that it is dealing with batches of items and what SpriteBatch items are batched up ? … are they sprites ? … No they are quads, which are pairs of triangles.
So a pair of triangles makes a square and we call that a sprite we also call em a quad so same thing 3 names.

You will see a diagram in this class in ascii art and should now immediately recognize the meaning here now.

The above function has pointer math all over it, that is to speed it up as much as possible as it is at the very center of spritebatch.

Im sure you have seen images of faces and other things made up of tons of triangles and now you can see that it all is just triangles.

Sometimes its easier to see a custom implementation all in one class file but spritebatch draws quads pairs of triangles and just wraps it up in nice methods that make things easy like to do rotations on the vertices and automatically sets up the matrices and has a build in shader stored in byte code it uses and such.

It’s essentially a even more fancy version of the below simple quad draw example.

But keep in mind ultimately your gpu is just this grid like you saw in school in math class. It is ranging from -1 to +1 x and y with some special sauce that round off to discrete points that relate to the screen resolution and store pixels and data for them. Of course it can do all kinds of things that amp this grid up like rasterize triangles with edge points that match up to points on a image.

For example if you look on this grid and take the value -.5 and think of your screen from left to right with a screen resolution of 1000 width trying to fit in this little space.

Then that puts it -.5 about a quarter ways from the left of your screen or 250 pixels.
So if you take -1 to 1 that’s a width of just 2 so do this… add 1 so the range is 0 to 2 then divide by 2 you get a range now from 0 to 1 then multiply it by 1000 the screen width and if you do that to the -.5
(-.5 + 1 = .5 / 2 = .25 * 1000) … you get that 250 pixel x position.
That is what the orthographic projection matrix is doing for spritebatch and so when you look at the batcher you see those little numbers and you are inputing big numbers relating to the screen.
You position quads with a world matrix and move everything all of the world with a view matrix and walaaa your little grid is anything you want it to be. Including having a layer depth a z coordinate.
Of course all of that is dumbed down to were you just use spritebatch.Draw and its familiar methods related to the screen resolution which we of course know when we change it can be anything.

So sprite batch makes its super easy to draw squares out of triangles and pretty them up in a really simple way so you don’t have to do a lot of extra stuff yourself like in the example post above.