Jump to content

  • Log In with Google      Sign In   
  • Create Account


[SlimDX] Text Rendering Issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 MaacK   Members   -  Reputation: 140

Like
0Likes
Like

Posted 11 January 2012 - 12:36 AM

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.

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..

Sponsor:

#2 MaacK   Members   -  Reputation: 140

Like
0Likes
Like

Posted 13 January 2012 - 12:04 AM

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

Attached Thumbnails

  • wtfmate.png


#3 Adam_42   Crossbones+   -  Reputation: 2354

Like
1Likes
Like

Posted 13 January 2012 - 08:07 AM

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.

#4 MaacK   Members   -  Reputation: 140

Like
0Likes
Like

Posted 13 January 2012 - 05:48 PM

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?

#5 Adam_42   Crossbones+   -  Reputation: 2354

Like
1Likes
Like

Posted 13 January 2012 - 07:34 PM

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.

#6 MaacK   Members   -  Reputation: 140

Like
1Likes
Like

Posted 14 January 2012 - 03:10 AM

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 ! Posted Image Posted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS