【发布时间】:2014-06-04 00:44:58
【问题描述】:
XNA spritebatch.End();一个类不起作用,它说:'XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture size that are not the power of two.'开始时。它也没有显示任何错误。我该如何解决这个问题?请帮忙!!
public override void Draw()
{
Statics.SPRITEBATCH.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, null,null);
Statics.SPRITEBATCH.Draw(this.background, Vector2.Zero, Color.White);
foreach (var item in Tuyaux)
{
item.Draw();
}
Statics.SPRITEBATCH.Draw(this.sand, new Vector2(0, 529), Color.White);
Scroll.Draw();
Bird.Draw();
Statics.SPRITEBATCH.DrawString(this.Font, "Score : " + this.score.ToString(), new Vector2(10, 10), Color.Red);
if (Bird.dead)
{
// rode gloed over het spel als het gameover is.
Statics.SPRITEBATCH.Draw(Statics.PIXEL, new Rectangle(0,0, Statics.GAME_WIDTH,Statics.GAME_HEIGHT), new Color(1f, 0f, 0f, 0.3f));
// gameover achtergrond laten zien.
Statics.SPRITEBATCH.Draw(this.gameover, new Vector2(0, 80), Color.White);
}
Statics.SPRITEBATCH.End();
base.Draw();
}
【问题讨论】:
-
“同课”是什么意思?我很确定确实,您只需要使用 2 次方的纹理大小,因为您针对 Reach 配置文件进行编译并且不使用 Clamp!
this.background、this.sand、Statics.PIXEL(我希望是 1x1)和this.gameover的尺寸是多少?我怀疑您在自己的Draw方法中绘制到相同的SpriteBatch... 也检查那里使用的纹理。异常准确地说明出了什么问题;-)