Sign in to follow this  
Yura

Draw text and color bar using sprites

Recommended Posts

Yura    263

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 this post


Link to post
Share on other sites
Balk    146

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 this post


Link to post
Share on other sites
Yura    263

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]

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