-
|
|
Problem with Drawing Text
|
I am trying to get my program to draw text to the screen, but for whatever reason it doesn't draw it even though none of the functions that I use actually fail. Here is my code in the while loop of my program:
1 2 3 4 5 6 7 8 |
float color[] = { 0.f, 0.125f, 0.6f, 1.f }; dx10Device->ClearRenderTargetView(renderView, color); swapChain->Present(0, 0);
HRESULT hr; RECT rc; SetRect(&rc, 0, 0, 640, 480); hr = someFont->DrawTextA(NULL, "hello", 5, &rc, DT_CENTER | DT_VCENTER, D3DXCOLOR(0.f, 0.125f, 0.f, 1.f)); |
And here is my code to create the font:
1 2 3 4 5 6 |
HRESULT hr;
hr = D3DX10CreateFontA(dx10Device, 30, 0, FW_NORMAL, 1, true, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &someFont); if( FAILED(hr) ) MessageBoxA(NULL, "D3DX10CreateFontA failed", "Error", MB_OK); |
Any ideas?
|
|
-
|
|
Re: Problem with Drawing Text
|
1 2 3 4 5 6 7 8 | float color[] = { 0.f, 0.125f, 0.6f, 1.0f }; dx10Device->ClearRenderTargetView(renderView, color); swapChain->Present(0, 0);
HRESULT hr; RECT rc; SetRect(&rc, 0, 0, 640, 480); hr = someFont->DrawTextA(NULL, "hello", 5, &rc, DT_CENTER|DT_VCENTER, D3DXCOLOR(0.f, 0.125f, 0.0f, 1.0f)); |
Are you sure to - Present the scene before drawing text?
- Set the color of the text equal not for reading (bad color mean to back buffer)?
Nice greets, Patrick Polzin
|
|
-
|
|
Re: Problem with Drawing Text
|
1 2 3 4 5 6 7 8 | float color[] = { 0.f, 0.125f, 0.6f, 1.0f }; dx10Device->ClearRenderTargetView(renderView, color); swapChain->Present(0, 0);
HRESULT hr; RECT rc; SetRect(&rc, 0, 0, 640, 480); hr = someFont->DrawTextA(NULL, "hello", 5, &rc, DT_CENTER|DT_VCENTER, D3DXCOLOR(0.f, 0.125f, 0.0f, 1.0f)); |
Are you sure to - Present the scene before drawing text?
- Set the color of the text equal not for reading (bad color mean to back buffer)?
Nice greets, Patrick Polzin
|
|
|