Original Post
I have been trying to add text to my application using ID3DX10Font and D3DX10CreateFont but every time I say DrawText my other geometry stops rendering correctly. I have attached images of output window with text and with text disabled. I use this code to initialize:
[source lang="cpp"]g_pFont = nullptr;
HRESULT hr = D3DX10CreateFont(g_pd3dDevice,
35, // the font height
0, // the font width
FW_BOLD, // the weight of the font
1, // number of mip levels
FALSE, // this is not an italic font
DEFAULT_CHARSET, // default character set
OUT_DEFAULT_PRECIS, // default size mapping
DEFAULT_QUALITY, // default quality mapping
DEFAULT_PITCH | FF_DONTCARE, // default pitch
L"Helvetica", // use Helvetica as the basis for this font
&g_pFont); // the output
// make sure the font was created correctly
if (FAILED(hr))
{
return hr;
}
return S_OK;[/source]
and to draw:
[source lang="cpp"]HRESULT hr = g_pFont->DrawText( NULL,
TEXT("This is a test string"),
-1,
&rc,
DT_LEFT,
D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );[/source]
Any help appreciated.
[source lang="cpp"]g_pFont = nullptr;
HRESULT hr = D3DX10CreateFont(g_pd3dDevice,
35, // the font height
0, // the font width
FW_BOLD, // the weight of the font
1, // number of mip levels
FALSE, // this is not an italic font
DEFAULT_CHARSET, // default character set
OUT_DEFAULT_PRECIS, // default size mapping
DEFAULT_QUALITY, // default quality mapping
DEFAULT_PITCH | FF_DONTCARE, // default pitch
L"Helvetica", // use Helvetica as the basis for this font
&g_pFont); // the output
// make sure the font was created correctly
if (FAILED(hr))
{
return hr;
}
return S_OK;[/source]
and to draw:
[source lang="cpp"]HRESULT hr = g_pFont->DrawText( NULL,
TEXT("This is a test string"),
-1,
&rc,
DT_LEFT,
D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );[/source]
Any help appreciated.