Directxtk SpriteFont模糊时不是整数

时间:2016-07-13 12:29:47

标签: directx-11 blurry spritefont directxtk

enter image description here

如果我使用非整数作为字符串的位置,文本会变得模糊。是什么导致了这个以及如何纠正它?

this->pSpriteBatch->Begin();
this->pSpriteFont->DrawString(this->pSpriteBatch, szTempMessage, XMFLOAT2(x, y), color);
this->pSpriteBatch->End();

我只用位置和颜色参数调用它。

1 个答案:

答案 0 :(得分:0)

默认情况下,

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();

看看这是否会改善您的结果。