Sign in to follow this  
SmoothRide

D3D Font issue

Recommended Posts

I have a strange issue with the font feature. It used to work correctly in my program, but recently I began experiencing this glitch where the font appears for a few seconds when I start the program and then disappears. It reappears every few seconds, very briefly, and then goes away again. I don't understand what is going on with it. I was hoping maybe somebody ran into this issue before and knows how to fix it. For reference purposes, see code snippets below. I pretty much took it all from online tutorials. Here's my font creation code:
	HRESULT hr;
	hr=D3DXCreateFont(p_dx_device,     //D3D Device
                     -MulDiv(16, 96, 72),               //Font height
                     0,                //Font width
                     0,        //Font Weight
                     0,                //MipLevels
                     false,            //Italic
                     ANSI_CHARSET,  //CharSet
                     OUT_DEFAULT_PRECIS, //OutputPrecision
                     DEFAULT_QUALITY, //Quality
                     FF_MODERN,//PitchAndFamily
                     "Arial",          //pFacename,
                     &p_dx_font);         //ppFont

	return p_dx_font;

Here's the display call:
	_itoa(in_frame_counter, str, 10);
	if(FAILED(SetRect(&rectangle, 0, 0, 200, 40))){
			rectangle.top = 0;
			rectangle.left = 0;
			rectangle.right = 200;
			rectangle.bottom = 40;
	}
        p_dx_font->DrawText(NULL, str, -1, &rectangle, DT_LEFT|DT_NOCLIP, 0xffff0000);

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