Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Problem Tiling a Sprite

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 Inu_   Members   

281
Like
0Likes
Like

Posted 07 December 2012 - 05:29 PM

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:

tilingsprite.png


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

  spriteBatch.Begin(SpriteSortMode.BackToFront,
						BlendState.AlphaBlend,
						null,
						null,
						null,
						null);
			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);
  spriteBatch.End();

Edited by Inu_, 07 December 2012 - 06:00 PM.


#2 phil_t   Members   

8005
Like
2Likes
Like

Posted 07 December 2012 - 10:27 PM

The default SamplerState for SpriteBatch is LinearClamp. You want LinearWrap

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




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.