Draw text and color bar using sprites

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

Recommended Posts

Hi,

I'm trying to draw text and color bar on my scene using sprites.

I want to achieve something like this: [attachment=13506:Capture2.PNG]

I've tried to use this:

Font font = new Font(d3dDevice, new System.Drawing.Font("Arial", 20,
System.Drawing.FontStyle.Regular));
Sprite spr = new Sprite(d3dDevice);
spr.Begin();
font.DrawText(spr, "some string", 10, 20, new ColorBGRA(0, 65, 200, 0));
spr.End();



but I've got just solid rectangles instead of each letter.

So, what should I do to receive desired result?

Share on other sites

I'm not sure what you mean by "solid rectangles", but it may be that you don't have the correct render states enabled to draw text.

D3DXSPRITE_ALPHABLEND

D3DXSPRITE_SORT_TEXTURE

try enabling those states on the d3dDevice using SetRenderState();

Share on other sites

I'm not sure what you mean by "solid rectangles", but it may be that you don't have the correct render states enabled to draw text.

D3DXSPRITE_ALPHABLEND

D3DXSPRITE_SORT_TEXTURE

try enabling those states on the d3dDevice using SetRenderState();

ALPHABLEND helped, thx

[RESOLVED]