Original Post
I really hope it's not something stupid due to lack of sleep but I'm having a problem rendering text in my d3d9 app on Vista (if that makes any difference). I know there's no error checking in this code but I've stepped through and checked the return values in the debugger and they all succeed apart from the DrawText call.
The DrawText line always fails. In this example it returns 0xA "The environment is incorrect." If I change the font to Courier New it returns 0x8 "Not enough storage is available to process this command."
I've tried with and without Begin/EndScene calls - same problem.
Any help would be greatly appreciated!
// HACK!! static ID3DXFont* font = NULL; if(font==NULL) { res = D3DXCreateFont( d3ddev, 10, 0, FW_DONTCARE, 0, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Verdana", &font ); AssertNoMessage( SUCCEEDED( res ) ); } res = d3ddev->BeginScene(); static D3DCOLOR fontColor = D3DCOLOR_ARGB(255, 255, 255, 255); static Int32 lineHeight = 12; static Int32 lineWidth = 500; static Int32 startPosX = 20; static Int32 startPosY = 20; { RECT rect; rect.top = startPosY; rect.bottom = rect.top + lineHeight; rect.left = startPosX; rect.right = startPosX + lineWidth; res = font->DrawText( NULL, "hello", 5, ▭, DT_LEFT|DT_NOCLIP, fontColor ); res = d3ddev->EndScene(); return; }The DrawText line always fails. In this example it returns 0xA "The environment is incorrect." If I change the font to Courier New it returns 0x8 "Not enough storage is available to process this command."
I've tried with and without Begin/EndScene calls - same problem.
Any help would be greatly appreciated!