Advertisement

Horizontal lines of pixels "missing" in windowed mode...

Started by September 20, 2018 08:21 AM
30 comments, last by suliman 6 years, 3 months ago

If the window style of the engine never changes (which I doubt it would), the quick easy fix would be to compensate in the window resize


// settings for the window
RECT wr = { 0, 0, gfx.screenX, gfx.screenY };    // set the size, but not the position
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);    // adjust the size

inHGE->System_SetState(HGE_WINDOWED, !fullScreen);
inHGE->System_SetState(HGE_SCREENWIDTH, wr.right - 16);
inHGE->System_SetState(HGE_SCREENHEIGHT, wr.bottom - 39);

Note: wr.left and wr.top are not needed in this case as they will always be zero.

@DarkRonin
The suggested code does not work. I still get skipped lines. Also they are not zero after AdjustWindowRect (wr.left is -8 and wr.top = -31)

Added info: i get skipped lines in 1920x1080 (screen native) and all other resolutions in windowed mode also. Also if add 100 pixels in both dimension it still skips lines. Fullscreen works fine in all modes.

Advertisement

If you're using Visual Studio there's a tool called Spy (or Spy++). You can use it to inspect your window while running. Make sure the client size is what you expect it to be.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Projection, viewport, render target size and windows client dimension (check with GetClientRect) all need to match. Debug if this is the case at the moment of drawing. A graphics debugger can also help.

I tried the spy ++ tool and got this:

image.png.421b385df3716f28f52a337f552fbf7d.png

The wanted/fullscreen resolution was 1600x900. The corrected was 1616x939 (after AdjustWindowRect this is what I sent to the engine) but the above show something different still.
Still lost:) Any idea why this differs and how to fix it?

How can I use GetClientRect? Im not sure how to get a handle to the window...

In the tab "Styles" you see the styles your window has. You have to pass the exact same ones to AdjustWindowRect(Ex). Make sure to include both regular and extended styles, and use AdjustWindowRectEx.

 

Still, I'm pretty sure HGE should account for that by itself. All these engines usually care for the actual usable (client) area only.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Advertisement

I tried that (there was 6 normal styles and 4 expended). But still the missing lines :(


		AdjustWindowRectEx(&wr, WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_SYSMENU | WS_MINIMIZEBOX, FALSE, WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_WINDOWEDGE);    // adjust the size

 

Regarding the modified RECT from AdjustWindowRectEx. Make sure you're passing right-left and bottom-top to HGE; there's a reason when Left and Top go negative.

 

Other, more hamfisted approach: Use Spy to calculate the difference and adjust the size in the HGE calls accordingly.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

@Endurion
Yes I do use right-left and bottom-top.

Regarding your second tip: I added 10 pixels to both width and height to get 1600x900 as "client rect" as seen below (it was 1590x890 in unaltered windowed mode). Is this what you meant?

The problem persists. (still is drawn with missing lines every 80 pixels or so (as seen earlier in this thread)).

I also matched it manually so the rectangle/restored rectangle becomes 1600x900 but this still gives the same missing lines of pixels.

image.png.31bf0deecca5102dcc8709078dcd5817.png

This topic is closed to new replies.

Advertisement