如何将xna的TextureFilter设置为Point

时间:2011-11-15 00:37:42

标签: xna-4.0

我有一点Texture2D:

myTexture = new Texture2D(GraphicsDevice,512,512,false,SurfaceFormat.Vector4);

当我尝试绘制它时:

        spriteBatch.Begin();
        spriteBatch.Draw(myTexture, new Rectangle(0, 0, 512, 512), Color.White);
        spriteBatch.End();

我得到一个例外:

“使用纹理格式Vector4时,XNA Framework HiDef配置文件要求TextureFilter为Point。”

如何将TextureFilter设置为Point?

1 个答案:

答案 0 :(得分:2)

SamplerState.PointClampSamplerState.PointWrap传递给SpriteBatch.Begin