#### Archived

This topic is now archived and is closed to further replies.

# CD3DFont problems

This topic is 5782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Has anyone used CD3DFont? I tried to use it last night after following the tutorial in the SDK, but I''m not doing something right. As far as I can tell, I need to: in my init: cFontBig = new CD3DFont( _T("Arial"), 24, D3DFONT_BOLD );cFontBig->InitDeviceObjects( pD3DDev );cFontBig->RestoreDeviceObjects(); Then in my render loop (condensed): pD3DDev->BeginScene();cFontBig->DrawText( 350, 250, D3DCOLOR_ARGB( 255, 0, 0, 127), _T("Level 1: Ready") );pD3DDev->EndScene(); Since I have a vertex buffer for my graphics, and cD3DFont creates one as well, how do I account for that? Right now, every other letter is showing and the ones that aren''t are blocks. Then when my game leaves that game state to go to start, it locks. Anyone know how to use CD3DFont properly, and how bad does it slow down a scene? Much greatness is achieved thru perseverance and faith.

##### Share on other sites
quote:
Anyone know how to use CD3DFont properly

look at any sdk sample.
quote:

and how bad does it slow down a scene?

##### Share on other sites
give this a try

    HFONT font_handle;LPD3DXFONT mpFont;//setupfont_handle = CreateFont(18, 0,0,0, FW_NORMAL, FALSE, FALSE,0,0, ANSI_CHARSET, 0,0,0,0, "Westminster");		D3DXCreateFont(g_pDevice, font_handle, &mpFont);//drawingRECT rect;rect.left = x;rect.top = y;rect.right = 0;rect.bottom = 0;				mpFont->Begin();mpFont->DrawTextA(buffer, -1, &rect, DT_CALCRECT, 0);mpFont->DrawTextA(buffer, -1, &rect, DT_LEFT, D3DCOLOR_XRGB(255, 255, 255));mpFont->End();

hope this helps

"Sweetie! Get Mommy's bazooka!"

[edited by - Mister Stewart on November 21, 2002 10:43:47 AM]

##### Share on other sites
I have always heard that LPD3DXFONT is pretty slow. I do want to know specifics, because I do not know for sure. I thought CD3DFont is faster. Is that true?

Much greatness is achieved thru perseverance and faith.

##### Share on other sites
CD3DFont does not use GDI, while LPD3DXFONT does. Thus why CD3DFont is MUCH faster than LPD3DXFONT. Note that this does come with a downside, artifacts are present when you use a large font with CD3D. Not also that CD3D does not support strikethrough (and I believe a few other styles. I''m pretty sure italic fonts are supported. perhaps not.)

¬_¬

##### Share on other sites
Ahh ok. I have some theories on my problem with CD3DFont, but I can''t try them until tonight. I''ve noticed it does change my VB to the font VB, but I guess I need to set my VB back each frame to render my graphics. I''ll see when I get home.

I do want to learn CD3DFont, but with the SDK, the classes bounce all over the place and I''m stepping thru to find all the steps needed to create a font.

Much greatness is achieved thru perseverance and faith.

1. 1
2. 2
3. 3
Rutin
22
4. 4
frob
17
5. 5

• 9
• 33
• 13
• 13
• 10
• ### Forum Statistics

• Total Topics
632582
• Total Posts
3007198

×