SpriteBatch resets SamplerStates…

In doing a bit more toying around with XNA, I’ve inadvertently discovered that calls to SpriteBatch.Begin() (or perhaps it is actually SpriteBatch.Draw()) will reset a bunch of render states. I knew that it did this, but I didn’t realize that it would reset the GraphicsDevice.SamplerStates as well. I was loading a model and trying to get texture wrapping to work on it, and couldn’t quite figure out whether it was the model that was bad or whether it was something in my app. It turns out it was in my app.

Moral of the story: When using SpriteBatch, assume that everything gets set to the opposite RenderState of what you want.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s