Jump to content
  • Advertisement
Sign in to follow this  
NightshadeX

[SLIMDX] Draw Text?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, what is the best way to draw text with SlimDX (e.g. Debug informations...). I tried to use font.Draw, but that doesn't seem to work (or is it me who is silly?).

Gdi works, but that's not a good solution (it will flicker...).


Are there other ways?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
I tried to use font.Draw, but that doesn't seem to work


It worked for me. This is how I used it:


// During initialization
font = new SlimDX.Direct3D9.Font(device, new System.Drawing.Font(FontFamily.GenericSansSerif, 14));

// During rendering
font.DrawString(null, "abc", 10, 60, Color.Maroon);



Though this is from an older version of SlimDX and I don't know if anything changed since then.

Share this post


Link to post
Share on other sites
Well I am using D3D10.

SlimDX.Direct3D10.Font font = new SlimDX.Direct3D10.Font(device, 14, "Arial");
.....
font.Draw(null, "abc", new Rectangle(100, 100, 500, 500), FontDrawFlags.Top, new Color4(0.0f, 0.0f, 0.0f, 0.0f));


This won't show anything and it is killing the depth buffer as well.

Share this post


Link to post
Share on other sites
Looks fine, the problem is likely in the "..." (or before, or after, the two valid lines of code you posted).

Share this post


Link to post
Share on other sites
Well i am initializing the font just one time of course.


The rendering thing is between:

device.ClearRenderTargetView(renderTarget, clearColor);
device.ClearDepthStencilView(renderTargetDepth, DepthStencilClearFlags.Depth, 1f, 0);

//Render.... also the font.Draw..

swapChain.Present(0, PresentFlags.None);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!