[SlimDX] Text Rendering Issue

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

Recommended Posts

I've been having a weird issue with SlimDX lately. The text is not rendering properly, it looks cut off. I'm using DirectX 9. See screenshot for information. I've messed with all the settings, and simply cannot figure out what's wrong!

As you can see in my screenshot, the text isn't rendering right. It looks cut off, or a random letter is missing.

[attachment=6672:Untitled.png]

Here is my code:

 Font fnt = new SlimDX.Direct3D9.Font(o.device, 16, 0, FontWeight.Black, 0, false, CharacterSet.Default, Precision.TrueTypeOnly, FontQuality.ClearTypeNatural, PitchAndFamily.DontCare, "Arial"); (The Game Loop) TextSprite.Begin(); fnt.DrawString(TextSprite, "Test", 0, 0, System.Drawing.Color.White); TextSprite.End(); (End GameLoop) 

Any ideas as to why this is happening or what I am doing wrong? Note that I am using a Dictionary to store multiple strings, I slightly edited the code - otherwise it'd be really long to post..

Share on other sites
I find it hard to believe no one has a solution? Here's another screenshot.

Share on other sites
Are you running in windowed mode?

If so did you use AdjustWindowRectEx() or the C# equivalent so that the back buffer is the same size as the client area?

Note that the artefacts aren't just affecting the text, they can be seen on the background pattern too, so the problem is not specific to the text.

Share on other sites

Are you running in windowed mode?

If so did you use AdjustWindowRectEx() or the C# equivalent so that the back buffer is the same size as the client area?

Note that the artefacts aren't just affecting the text, they can be seen on the background pattern too, so the problem is not specific to the text.

I'm not, I'll research this topic and see if I cansolve it. The background texture is like that - is not artifacts.

What is the fastest way for 2d graphics other than sprites?

Share on other sites
What I'm looking at in the background texture is that where there's a horizontal row of pixels missing from the text, there's also one missing from the repeating background texture, which you can see if you look closely. What that suggests to me is that your back buffer is not the same size as your window client area.

You can easily verify if I'm correct by running it in full screen mode instead of windowed.

Share on other sites
I see..

What I'm looking at in the background texture is that where there's a horizontal row of pixels missing from the text, there's also one missing from the repeating background texture, which you can see if you look closely. What that suggests to me is that your back buffer is not the same size as your window client area.

You can easily verify if I'm correct by running it in full screen mode instead of windowed.

Got it.

For anyone else:
PresentParams.BackBufferHeight = form.ClientRectangle.Height;
PresentParams.BackBufferWidth = form.ClientRectangle.Width;
Don't use:
PresentParams.BackBufferHeight = form.Height;
PresentParams.BackBufferWidth = form.Width;

Silly mistake.. thanks !

• 10
• 11
• 9
• 11
• 9