# ID3DXLine and LPD3DXFONT garbled in windowed mode fine in Fullscreen

## Recommended Posts

Dissipate    483

Hi all,

My text is displayed all garbled and my lines are all bitty. I think I understand why - I am creating a window 1280x720 with a 1920x1080 resolution and there aren't enough pixels (or whatever). Is there a solution to correctly display the lines and text created with ID3DXLine and LPD3DXFONT respectively?

Maybe recreate the objects in windowed mode then recreate again in fullscreen?

##### Share on other sites
unbird    8335
Without seeing code or screenshots my guess is a mismatch of your backbuffer and windows client area size, which you (correctly) set at device creation or reset with the presentation parameters. The alternative is to fit your window to the resolution you desire with the help of AdjustWindowRect and SetWindowPos.

##### Share on other sites
Dissipate    483

Thanks for the super speedy reply.

I have squashed my fullscreen image into my windowed form. Which is what I wanted. Heres my code:

if(m_D3DPP.Windowed)
return;

RECT ClientRect = {0, 0, WINDOWED_WIDTH, WINDOWED_HEIGHT};
m_D3DPP.BackBufferFormat = D3DFMT_UNKNOWN;
m_D3DPP.BackBufferWidth  = FULLSCREEN_WIDTH;
m_D3DPP.BackBufferHeight = FULLSCREEN_HEIGHT;
m_D3DPP.Windowed         = true;

SetWindowLongPtr(m_hWindow, GWL_STYLE, WS_OVERLAPPEDWINDOW);

SetWindowPos(m_hWindow, HWND_TOP,
100, 100,
ClientRect.right, ClientRect.bottom,
SWP_NOZORDER | SWP_SHOWWINDOW | SWP_FRAMECHANGED);


Here is a partial shot of the problem:

Am I windowing the correct way? It works though. I want to be keep showing the squashed screen in windowed form. Maybe I just have to put up with it? Or I could use my own bitmapped fonts...?

##### Share on other sites
unbird    8335
Careful: SetWindowPos wants width and height as the 5th and 6th parameter, not the bottom right. Also: I take it WINDOWED_WIDTH/HEIGHT are currently not equal to FULLSCREEN_WIDTH/HEIGHT. But they need to be to avoid the garble. Using a different font rendering won't help.

Why do you want to render at a higher resolution than you can display anyway ? Resolution independance ? Antialiasing ? You can do that, but you need a different approach: E.g. render to a higher texture/render target, and then display that texture with linear downsampling. Sort of super sampling. Or use multi sample anti aliasing, which is supported by D3D9. Not sure if the latter works with these D3DX helper objects, though, probably not.

Edit: Disclaimer: Since I'm not using C++, I might still miss something here (I use C#, WindowsForms and SlimDX). Edited by unbird