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

## Recommended Posts

Hi!

Im using an old 2d engine called "HGE" for rendering (the engine forum is now dead). My problem is that some pixels (it seems like horizontal lines) is cut (not drawn). This happens ONLY in windowed mode; in fullscreen mode this doesnt happen.

Any idea how to fix this? Or what its called? See a screenie below (the rectangle next to "fullscreen" checkbox is messed up: pixels in bottom is missing).

Edited by suliman

##### Share on other sites

If it only happens with text, it might be some rounding problem with font metrics at different sizes. If it happens to anything, it can be nearest-neighbour scaling of something that is unaffected in fullscreen mode but ruined when shrunk (or enlarged).

Can you render something sensitive to line removal (e.g. a whole screen of checkerboard with 1px by 1px squares) as a test?

Edited by LorenzoGatti

##### Share on other sites

I think this is the classical "Window is not set to the proper dimensions, so canvas will be scaled slightly" 😀
When creating a window, you must account for bordersize etc., there's some functions that can help you calculate it properly

##### Share on other sites

Suliman, can you post the code you're using to create your window?

It sounds like you are forgetting to call AdjustWindowRect on your window rect with the appropriate create flags before creating the window.

Edited by pindrought

##### Share on other sites

Thanks all for tips to test!

@pindrought
This seems to be a built-in windows function. Does it work with all engines? I've never been recommended to use it before  Would you use it in all applications?
(also im not home so cannot test this for a while)

##### Share on other sites
1 minute ago, suliman said:

Thanks all for tips to test!

@pindrought
This seems to be a built-in windows function. Does it work with all engines? I've never been recommended to use it before  Would you use it in all applications?
(also im not home so cannot test this for a while)

I had assumed you were using Windows. If you're not using windows, i'm not sure what the approach would be.

If you are using windows, and you create a 800x600 window for example, the window will be 800x600 INCLUDING THE BORDER. Your actual content of the window will be less though. This is what the AdjustWindowRect function is for - to adjust the window so that the actual rendering area matches the dimensions due to the borders or other window styles throwing it off.

If you are not using windows, I am not sure what the solution may be.

##### Share on other sites

Yes it's windows, but as I'm using a game engine I was not sure that function can be applied (lots of low-level stuff is handled automatically by the engine).

But i'll try it when I get the chance, thanks!

Edited by suliman

##### Share on other sites

Update. Yes it skips!. This is how it looks when drawing horizontal lines every two pixels in windowed mode (its the same problem with vertical lines):

I try this from an internet tutorial:

	// settings for the window
RECT wr = { 0, 0, gfx.screenX, gfx.screenY };    // set the size, but not the position

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

And it does correct the width and height (was 1600x900 but changed it into 1616x939 pixels) but still the same problem.
I also try it with the style WS_BORDER but the same problem persists.

Any ideas?

Edited by suliman

##### Share on other sites

Are you sure your window is just WS_OVERLAPPEDWINDOW?  Have you tried getting the window flags from the window itself first, to make sure you are adjusting to the correct ones?

##### Share on other sites

How can I do that? These are the calls I think can be relevant:

	hge = hgeCreate(HGE_VERSION);
hge->System_SetState(HGE_FRAMEFUNC, frameFunc);

hge->System_SetState(HGE_TITLE, tempT);
hge->System_SetState(HGE_HIDEMOUSE, true);
if (runAtFPS != -1)
hge->System_SetState(HGE_FPS, runAtFPS);
else
hge->System_SetState(HGE_FPS, HGEFPS_VSYNC);
hge->System_SetState(HGE_DONTSUSPEND, runAlways); //run even when not active window

// settings for the window
RECT wr = { 0, 0, gfx.screenX, gfx.screenY };    // set the size, but not the position
hge->System_SetState(HGE_WINDOWED, !fullScreen);
hge->System_SetState(HGE_SCREENWIDTH, wr.right - wr.left);
hge->System_SetState(HGE_SCREENHEIGHT, wr.bottom - wr.top);

hge->System_Initiate();

## Create an account

Register a new account

1. 1
2. 2
3. 3
4. 4
Rutin
15
5. 5

• 14
• 9
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
632912
• Total Posts
3009197
• ### Who's Online (See full list)

There are no registered users currently online

×