[SLIMDX] Draw Text?

Started by
3 comments, last by NightshadeX 13 years, 10 months ago
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?
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 initializationfont = new SlimDX.Direct3D9.Font(device, new System.Drawing.Font(FontFamily.GenericSansSerif, 14));// During renderingfont.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.
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.
Looks fine, the problem is likely in the "..." (or before, or after, the two valid lines of code you posted).
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);

This topic is closed to new replies.

Advertisement