Advertisement Jump to content
Sign in to follow this  

Problem Tiling a Sprite

This topic is 2235 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have na 32x32 sprite that is going to be the Grass/ground of my game, and I am trying to make it fill the entire screen, but the image actualy becomes all distorced.

Here is a picture of the problem:


And here is the Draw code(using XNA 4.0):

GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
Rectangle source = new Rectangle(0, 0, 500, 500);
spriteBatch.Draw(spritetest, Vector2.Zero ,source, Color.White, 0, Vector2.Zero,1.0f, SpriteEffects.None, 0.5f);
Edited by Inu_

Share this post

Link to post
Share on other sites
The default SamplerState for SpriteBatch is LinearClamp. You want LinearWrap

Pass SamplerState.LinearWrap for the 3rd parameter to SpriteBatch.Begin.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!