如果我使用非整数作为字符串的位置,文本会变得模糊。任何想法是什么导致了这个以及如何纠正它?
this->pSpriteBatch->Begin();
this->pSpriteFont->DrawString(this->pSpriteBatch, szTempMessage, XMFLOAT2(x, y), color);
this->pSpriteBatch->End();
我只用位置和颜色参数来调用它。
如果我使用非整数作为字符串的位置,文本会变得模糊。任何想法是什么导致了这个以及如何纠正它?
this->pSpriteBatch->Begin();
this->pSpriteFont->DrawString(this->pSpriteBatch, szTempMessage, XMFLOAT2(x, y), color);
this->pSpriteBatch->End();
我只用位置和颜色参数来调用它。
SpriteBatch
默认情况下使用渲染CommonStates::LinearClamp
,因此如果您渲染到子像素位置,它将变得模糊。您可以尝试使用另一种过滤模式,方法是使用以下命令覆盖它Begin
:
// create an instance of CommonStates as pStates
pSpriteBatch->Begin(SpriteSortMode_Deferred,
nullptr /*use default blend state */,
pStates->AnisotropicClamp());
pSpriteFont->DrawString(...);
pSpriteBatch->End();
看看这是否会改善您的结果。