jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.83k stars 1.13k forks source link

When the window size is bigger than the monitor's size, guiNode's translations mess up #732

Open realManix opened 7 years ago

realManix commented 7 years ago

jMonkeyEngine version: 3.2.0 alpha

For example, my desktop's monitor is 1980x1080, and when I set the window's height around 1060 or higher, the translations of guiNode's children are messed up. They work fine on full-screen mode (1980x1080). guiNode's children whose y values are small are fine, but children with higher y values aren't placed properly. The simplest way to test this would be to place something like BitmapText at the top of the screen (like this: https://anonimage.net/image/hHiwaZS5Qm) and it will be displayed properly until the window gets too tall for your screen (e.g., 1920x1080 windowed, due to the frame), for me the text got cut off.

I know that it probably isn't a good idea for the user to set the window size too big for their monitor, but I still don't want it to produce bugs like this. Hopefully someone more skilful than I could fix this.

shadowislord commented 7 years ago

Please attach a test case reproducing the problem. You can set the windowed resolution by using AppSettings. Also indicate your OS and GPU (ideally, provide the log from running the test case)

realManix commented 7 years ago

Test case:

`public class Main extends SimpleApplication {

public static final int WINDOW_WIDTH = 1920;
public static final int WINDOW_HEIGHT = 1080;

public static void main(String[] args) {
    Main app = new Main();
    app.setShowSettings(false);

    AppSettings appSettings = new AppSettings(true);
    appSettings.setWidth(WINDOW_WIDTH);
    appSettings.setHeight(WINDOW_HEIGHT);

    app.setSettings(appSettings);
    app.start();
}

@Override
public void simpleInitApp() {
    BitmapText bt = new BitmapText(guiFont);
    bt.setText("jMonkeyEngine3");
    bt.setLocalTranslation(0, WINDOW_HEIGHT, 0);

    guiNode.attachChild(bt);
}

}`

Case when I set the WINDOW_HEIGHT to 900: https://anonimage.net/image/LBKXFHMSQt Case when I set the WINDOW_HEIGHT to 1080: https://anonimage.net/image/CKZEOyJEnz

OS: Windows 10 GPU: NVIDIA GeForce GTX 1060 6BG

JESTERRRRRR commented 6 years ago

Can't see any of the images anymore. I think it's positioned correctly though.

Display.getHeight() returns 1064 (for my 1080 desktop height - I assume the gap is for the border) no matter what I set the height to in the appSettings, so I can't make the display bigger than the monitors resolution and the GUI element appearing too high up is correct since it's being placed off screen.

If you set:

System.setProperty("org.lwjgl.opengl.Window.undecorated","true");

you can set the window size bigger, e.g. height = 3000. With this Display.getHeight() returns 3000 but if you stick something on the GUI node at 0,3000 it'll appear in the top left, and anything with a height of 0 will appear off screen. Not sure if this would be considered a problem.