我得到这个异常:
XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture sizes that are not powers of two.
在 Reach 设置下运行我的游戏时。
我已经将所有内容都设置为使用 SamplerState.LinearClamp,但仍然到处都在抛出异常!
例如
spriteBatch.Begin(0, BlendState.Opaque, SamplerState.LinearClamp, DepthStencilState.None,
RasterizerState.CullCounterClockwise, effect);
spriteBatch.Draw(texture, new Rectangle(0, 0, width, height), Color.White);
spriteBatch.End();
这应该行得通吧??但事实并非如此!
帮助!
最佳答案
我的 XNA 知识可能有点过时了,但是如果 SpriteBatch 设置为 SpriteSortMode.Immediate,你不能只改变混合/光栅器状态吗?
当然,另一种选择是确保所有纹理都是二的幂,无论如何它们确实应该是;)
关于exception - 将 TextureAddressMode 设置为 Clamp for XNA Reach,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4644447/