Draw text and color bar using sprites

Started by
1 comment, last by Yura 11 years, 3 months ago

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?

Advertisement

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();

Can I play with madness?

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]

This topic is closed to new replies.

Advertisement