Skip to content

Add support for Multiple Monitors in jme-LWJGL3 #2030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bob0bob opened this issue Jun 5, 2023 · 6 comments
Open

Add support for Multiple Monitors in jme-LWJGL3 #2030

bob0bob opened this issue Jun 5, 2023 · 6 comments

Comments

@bob0bob
Copy link
Contributor

bob0bob commented Jun 5, 2023

Add support for multiple monitors.
Add a feature so that when a "Full Screen" window is created, that you can tell it which monitor to create the window on.
Add a feature so that the application can call context to get a list of monitors that OPENGL found. It returns them in an ArrayList so that the programmers can select a monitor from the list. JME will take the pos of the monitor from the arraylist to get its handle. So if you have 2 monitors, you will have 2 in the list. So to tell JME which monitor to create the window on it would be 0 or 1. The array position in the list.

The thought behind this is the program gets a list of monitors and then they can use that list in their settings for the user to select which monitor to us.
Since the ID of the monitor changes between each launch, I went with the position from the arraylist that it returned. So many if user changes the order of the monitors then the program will launch on a different screen. Minor.

Added in AppSettings a way to get/set Monitor. Monitor value is used only when creating a Full Screen.

bob0bob added a commit to bob0bob/jmonkeyengine that referenced this issue Jun 5, 2023
Add support for multiple monitors.
Add a feature so that when a "Full Screen" window is created, that you can tell it which monitor to create the window on.
Add a feature so that the application can call context to get a list of monitors that OPENGL found. It returns them in an ArrayList so that the programmers can select a monitor from the list. JME will take the pos of the monitor from the arraylist to get its handle. So if you have 2 monitors, you will have 2 in the list. So to tell JME which monitor to create the window on it would be 0 or 1. The array position in the list.

The thought behind this is the program gets a list of monitors and then they can use that list in their settings for the user to select which monitor to us.
Since the ID of the monitor changes between each launch, I went with the position from the arraylist that it returned. So many if user changes the order of the monitors then the program will launch on a different screen. Minor.

Added in AppSettings a way to get/set Monitor. Monitor value is used only when creating a Full Screen.
bob0bob added a commit to bob0bob/jmonkeyengine that referenced this issue Jun 5, 2023
Add support for multiple monitors.
Add a feature so that when a "Full Screen" window is created, that you can tell it which monitor to create the window on.
Add a feature so that the application can call context to get a list of monitors that OPENGL found. It returns them in an ArrayList so that the programmers can select a monitor from the list. JME will take the pos of the monitor from the arraylist to get its handle. So if you have 2 monitors, you will have 2 in the list. So to tell JME which monitor to create the window on it would be 0 or 1. The array position in the list.

The thought behind this is the program gets a list of monitors and then they can use that list in their settings for the user to select which monitor to us.
Since the ID of the monitor changes between each launch, I went with the position from the arraylist that it returned. So many if user changes the order of the monitors then the program will launch on a different screen. Minor.

Added in AppSettings a way to get/set Monitor. Monitor value is used only when creating a Full Screen.
bob0bob added a commit to bob0bob/jmonkeyengine that referenced this issue Jun 5, 2023
Add support for multiple monitors.
Add a feature so that when a "Full Screen" window is created, that you can tell it which monitor to create the window on.
Add a feature so that the application can call context to get a list of monitors that OPENGL found. It returns them in an ArrayList so that the programmers can select a monitor from the list. JME will take the pos of the monitor from the arraylist to get its handle. So if you have 2 monitors, you will have 2 in the list. So to tell JME which monitor to create the window on it would be 0 or 1. The array position in the list.

The thought behind this is the program gets a list of monitors and then they can use that list in their settings for the user to select which monitor to us.
Since the ID of the monitor changes between each launch, I went with the position from the arraylist that it returned. So many if user changes the order of the monitors then the program will launch on a different screen. Minor.

Added in AppSettings a way to get/set Monitor. Monitor value is used only when creating a Full Screen.
@bob0bob
Copy link
Contributor Author

bob0bob commented Oct 4, 2023

I've updated the code to handle multiple windows.

yaRnMcDonuts added a commit that referenced this issue Jan 4, 2025
 Add support for Multiple Monitors in jme-LWJGL3 #2030
@pavly-gerges
Copy link
Contributor

Has this issue been resolved? Why is it still open?

@yaRnMcDonuts
Copy link
Member

yaRnMcDonuts commented Feb 4, 2025

I have been waiting to close this until the PR gets tested more, since I ran into some possible issues with multiple monitor support on one of my devices. I also am not sure if it has gotten significant testing, no one has reported any success nor failure while running this test yet, unfortunately, so I'm not sure if my errors are an edge case, or if these are common issues that just haven't been found due to lack of testing accross other devices.

I personally was not able to get the Example to work to display fullscreen on the secondary monitor on my device.

At first I thought it still worked in non fullscreen mode, but then I realized that it was drawing a single wide viewport that stretched across both of my monitors when not in full screen mode. So it seems to be treating both of my monitors as if they are one very wide monitor.

And when in full screen mode, it appears to render properly at first. But the default fullscreen resolution is equal to the value of both my screens added together (I.E. isntead of being ~1500 width resolution, my resolution is ~3000 because I have 2 each about 1500 pixels in width). So the display on the primary monitor ends up having a resolution in fullscreen mode that is double what it shouuld be, which also cases the sizes for all gui components to be shrinked in half as well.

I also have not heard if anyone else (other than the author of the PR) has had success using Multiple Monitor support.

If this feature can be fixed to not cause any resolution issues, then I'd like to try to keep this PR for 3.8. I assume that the issues I'm experiencing are device related, since the author of the PR has been using this in their own project for a while. So hopefully this can all be fixed.

@bob0bob does everything with multiple monitor support still work on your device that you developed this on?

@bob0bob
Copy link
Contributor Author

bob0bob commented Feb 4, 2025

I have not had any issue with multiple monitors. Controlling which monitor it will display on works only for full screen. It doesn't work in window mode.
I have tried it with 2 monitors, 2 monitors being vertical. Also, 1 vertical and 1 horizontal. I have for the hoizontal monitor, I had to make adjustments to check resolution of the display and alter settings with it is a 16:9 vs. 9:16.

My displays report back the correct resolution that I have setup for them.

2560x1440 or 1440 x 2560 120hz. I had a laptop, which was only a stand monitor and it reported the display resolution correctly also.

@yaRnMcDonuts
Copy link
Member

yaRnMcDonuts commented Feb 4, 2025

So I think I can avoid the doubled resolution issue when running fullscreen on my primary monitor by manually setting the correct resolution.

However it does appear that my device is still failling to detect the secondary monitor when I run the example. It says I have just 1 monitor with the resolution of both of my monitors combined. (I assume thats probably why I'm getting a doubled resolution in full screen by default)

Could there be any reason on my end that it is not detecting my second monitor?

I also made a post to the jme hub, hopefully we can get some reports from other testers and potentially find out if certain devices or monitor types are being finnicky.

@yaRnMcDonuts
Copy link
Member

Here is a screenshot (taken with the print screen key) showing a full view of both of my monitors when I set the resolution manually after building the latest version of the engine (3.8.0-alpha3) in the command prompt and then run the test MonitorTestApp example:.

Image

Even though I have 2 monitors, it is saying that only 1 is detected.

Also, here is a screenshot showing how it now defaults to a 3k x resolution that is equal to the wide of both monitors whenever I click the "fullscreen" checkbox prior to launching an example:

Image

Both of my monitors sizes are ~1900 wide and ~1000 in height, so it looks like JME is now detecting them as 1 combined monitor and offering this larger 3820 x 2160 resolution as the default for fullscreen now.

So I think this resolution may resolve itself if we can figure out how to fix it so my device detects both monitors as 2 separate monitors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants