Sign in to follow this  
the dodger uk

GPU particles disappear when i try to render text?

Recommended Posts

	static RECT textbox;

	static LPD3DX10FONT ppFont;
	string str("fred");
	static bool done = false;
	if ( !done)
		SetRect(&textbox, 0, 0, 1344, 745);
		D3DX10CreateFont(g_pd3dDevice,    // the D3D Device
			17,    // font height
			0,    // default font width
			FW_NORMAL,    // font weight
			1,    // not using MipLevels
			false,    // italic font
			DEFAULT_CHARSET,    // default character set
			OUT_DEFAULT_PRECIS,    // default OutputPrecision,
			DEFAULT_QUALITY,    // default Quality
			DEFAULT_PITCH | FF_DONTCARE,    // default pitch and family
			"Arial",    // use Facename Arial
			&ppFont);    // the font object

		done = true;
	D3DXCOLOR white(1,1,1,1);

	ppFont->DrawTextA(NULL,str.c_str(),strlen(str.c_str()),&textbox,DT_LEFT | DT_TOP,white);
	// Present the backbuffer contents to the display. 1st parameter = 0: present immediately,  = 1: wait for next vsync
	g_pSwapChain->Present( 1, 0 );


 i have this HACKED in and if i use it , it makes the gpu particles disaper,  , if i not DrawTextA , then the particles apear 


can any one tell me what stupid mistake i am making here please

Share this post

Link to post
Share on other sites

you do not have to present the backbuffer every time you make a draw call, only once a frame (at the end).

if however, this is the end of the render function, check device settings (culling, input layouts, ...) as the drawing of the text might change some settings.

Share this post

Link to post
Share on other sites
You must change your states to default after rendering font object, since it changes some of them internally.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this