开发者

How do I set the texture sampler state in XNA for BasicEffect?

开发者 https://www.devze.com 2023-01-30 22:29 出处:网络
According to microsoft the BasicEffect.Texture uses the TextureFilter state and if it\'s not set it开发者_StackOverflow社区 uses TextureFilter.Linear.

According to microsoft the BasicEffect.Texture uses the TextureFilter state and if it's not set it开发者_StackOverflow社区 uses TextureFilter.Linear.

Where can I set the TextureFilter state for BasicEffect?

Is it possible to set a clamp/wrap method for texture sampling?


This can also be specified in SpriteBatch.Begin().
e.g.:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone);

See a discussion on this at: http://forums.create.msdn.com/forums/t/63537.aspx


EDIT

Got rid of my last answer. I knew that I had written it a cleaner way before.

Try:

GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;

SamplerState members can be found here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号