dx 10 c++ font and sprites

Started by
2 comments, last by mancubit 14 years, 6 months ago
hy. I'm tring to draw some text in my c++ dx10 application like this:

ID3DX10Font* mFont;
.
D3DX10_FONT_DESC fontDesc;
    fontDesc.Height          = 24;
    fontDesc.Width           = 0;
    fontDesc.Weight          = 0;
    fontDesc.MipLevels       = 1;
    fontDesc.Italic          = false;
    fontDesc.CharSet         = DEFAULT_CHARSET;
    fontDesc.OutputPrecision = OUT_DEFAULT_PRECIS;
    fontDesc.Quality         = DEFAULT_QUALITY;
    fontDesc.PitchAndFamily  = DEFAULT_PITCH | FF_DONTCARE;
    wcscpy(fontDesc.FaceName, L"Times New Roman");
    D3DX10CreateFontIndirect(g_pd3dDevice, &fontDesc, &mFont);
.

RECT R = {5, 5, 0, 0};
mFont->DrawTextW(0, mFrameStats.c_str(), -1, &R, DT_NOCLIP, WHITE);
g_pSwapChain->Present( 0, 0 );


But i have some textured and non meshes in my application , and when i draw text all my textured meshes appear wrong. I read that the text change silently the state of the device! is true? how i can resolve? Thanks
Advertisement
Just set your own states again after rendering the text.

Niko Suni

i'm try , but not work , when i call drawtext all the meshes remain wrong.
Have two lines of code for explain your solution?
Thanks
try the following after using drawfont (dont know which of these commands you really need:

md3dDevice->OMSetDepthStencilState(0, 0);md3dDevice->OMSetBlendState(0, {0.0f, 0.0f, 0.0f, 0.0f}, 0xffffffff);md3dDevice->IASetInputLayout(VertexLayoutVariable);md3dDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

This topic is closed to new replies.

Advertisement