   CD3DFont problem
  Hey guys, Im having a problem getting CD3DFont to work properly.  Ive got it to the stage where I can write a string to the screen (using DrawText) but that causes the whole screen to go black with just the text showing...there are no parameters like rect size or anything as far as I can see.Cheers 
  Would you mind posting the code where you initialize CD3DFont and the rendering code?  Also, did you look in the SDK framework to see how they use CD3DFont?   ;  Yeah, sorry, heres the code:I have a class called DXFont which is supposed to handle text drawing etc.(font is a private member of DXFont)DXFont::DXFont(LPDIRECT3DDEVICE9 D3DDevice){font = new CD3DFont(_T("Verdana"), 8);font->InitDeviceObjects(D3DDevice);font->RestoreDeviceObjects();}void DXFont::drawString(int x, int y, char * text){font->DrawText(x, y, D3DCOLOR_ARGB(255,255,255,0), text); }then I just call the drawString method.  It doesnt seem to matter whether I call it before drawing other objects or afterwards, all I get is a black screen with a bit of text on it >: ;  Hmm, when I use CD3DFont, I never use the RestoreDeviceObjects() function (All I use are InitDeviceObjects() and InvalidateDeviceObjects()).  Try taking it out, maybe. ;  hmm, ok. I read somewhere else that you have to call RestoreDeviceObjects() when init''ing the font.  If I didnt call it I got a runtime error.Where do you call InvalidateDeviceObjects()? Im not using CMyD3DApplication class that is used in the SDK, maybe thats the problem....;quote:Original post by _zero_  hmm, ok. I read somewhere else that you have to call RestoreDeviceObjects() when init''ing the font.  If I didnt call it I got a runtime error.- InitDeviceObjects() creates d3d-managed resources, and thus it needs to be called only once.- RestoreDeviceObjects() creates app-managed (D3DPOOL_DEFAULT) resources, and thus it needs to be called whenever a lost device has been reset.- DeleteDeviceObjects() releases app-managed (D3DPOOL_DEFAULT) resources, and thus it needs to be called whenever a lost device is to be reset (i.e. before the reset)- InvalidateDeviceObjects() releases all the resources.So, it goes like this (pseudo):Create d3d objectCreate deviceCreate fontfont::InitDeviceObjectsfont::RestoreDeviceObjectsRendering loop    if device is lost and is ready to be reset   font::DeleteDeviceObjects   device::Reset   font::RestoreDeviceObjects    endend loopfont::InvalidateDeviceObjectsdevice::Released3dObject::Release  quote:Where do you call InvalidateDeviceObjects()? Im not using CMyD3DApplication class that is used in the SDK, maybe thats the problem....It''s not a problem to use CD3DFont anywhere. Just make sure your usage is along the one outlined above. Muhammad Haggag