0
votes

Alright guys so my issue is very peculiar. I am mapping a texture onto a quad. The texture contains font values generated with Free Type. When I render it to the screen it has artifacts. "Hola, elienay, y Khaleexy" is the rendered quad/texture.

enter image description here

However, when I go into shader debug mode and look at the texture to see why it has artifacts, I do not get artifacts. The quad is rendered perfectly and the back buffer has the final colors correctly without 1 single artifact; see below. enter image description here

Alright, so you guys see what I'm talking about? The quad is being rendered and mapped perfectly to the texture but it seems that the issue is when the application presents the back buffer to the screen. Any ideas on what this could be caused by and how to fix it??

Below are a couple more screen shots with different random characters. To show how the artifacts are present only when not rendering the scene in debug mode. Artifacts 1 No artifacts when rendering the same scene in debug mode

1
If I had to guess, I'd say that you've created a swap chain as large as your window not the client size of the window. By that I mean, the window itself includes a small border and the title bar, areas to which you can't render, so your swap chain will need to be reduced in size very slightly in order to fit the client rectangle. Try measuring the size of the render target and the area of the window to which you can render and see if they match exactly. - Adam Miles
Adam that is a hell of it guess, however that was the first thing I checked. In fact, I am using AdjustWindowRectEx() to get the right size of the client area. Again, hell of a guess man. - Miguel
Alright, Adam. You were right. I checked this and it should've been working correctly, however, towards the bottom of the function somebody else went ahead and edited the function call and the wrong parameters were being passed. Post your answer and I will accept it. - Miguel

1 Answers

1
votes

As per 1st comment, the swap chain needs to be created at the size of the client window rectangle not the entire window including title bar and borders. When the window is created a few pixels too large Windows will need to rescale the swap chain by a very small factor which means you lose the 1:1 pixel accuracy you would expect.