LWJGL Forum

Programming => Bug Reports / RFE => Topic started by: matheus23 on May 24, 2012, 20:11:13

Title: [BUG] DisplayModes in Archlinux with multiple Monitors
Post by: matheus23 on May 24, 2012, 20:11:13
I've written a little test program, to show the problem:


public static void main(String[] args) {
DisplayMode[] modes = null;
try {
modes = Display.getAvailableDisplayModes();
} catch (LWJGLException e) {
e.printStackTrace();
}
for (int i = 0; i < modes.length; i++) {
System.out.println("Found Display mode (" + i + "): w:" + modes[i].getWidth() + " h:" + modes[i].getHeight() + " bpp:" + modes[i].getBitsPerPixel() + ", " + modes[i].getFrequency() + " Hz.");
}
System.out.println();
GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
for (int j = 0; j < devices.length; j++) {
System.out.println("Awt-DisplayModes for GraphicsDevice (" + j + ")");
java.awt.DisplayMode[] awtModes = devices[j].getDisplayModes();
for (int i = 0; i < modes.length; i++) {
System.out.println("Found Awt-Display mode (" + i + "): w:" + awtModes[i].getWidth() + " h:" + awtModes[i].getHeight() + " bpp:" + awtModes[i].getBitDepth() + ", " + awtModes[i].getRefreshRate() + " Hz.");
}
}
}


That just prints out DisplayMode info from LWJGL first, then from AWT.
Thats, what it prints:

Found Display mode (0): w:2560 h:1024 bpp:24, 50 Hz.

Awt-DisplayModes for GraphicsDevice (0)
Found Awt-Display mode (0): w:1280 h:1024 bpp:-1, 0 Hz.
Awt-DisplayModes for GraphicsDevice (1)
Found Awt-Display mode (0): w:1280 h:1024 bpp:-1, 0 Hz.


LWJGL just finds the double-screen DisplayMode, which makes gaming with multiple monitors somhow really ... bad.
Title: Re: [BUG] DisplayModes in Archlinux with multiple Monitors
Post by: andre-d on June 27, 2012, 19:49:08
I have reported a similar bug before.  I am thinking I will implement an lwjgl multiple monitor style API.  When fullscreened lwjgl also assumes that the window size is the desktop size, lwjgl also forces the window to resize to the entire desktop when fullscreening (even when using netWM). I would also like to add some methods for getting available displays as well as switching the window between them.
Title: Re: [BUG] DisplayModes in Archlinux with multiple Monitors
Post by: princec on June 27, 2012, 21:06:47
I think - correct me if I'm wrong - the thinking is that LWJGL Display means "give me all you've got", and it was geared around taking over the entire visual output of the display, especially if the display is presented to LWJGL as being one large surface. There was a school of thought that said AWT had perfectly adequate multi-monitor display APIs and if you wanted to properly utilise such displays you'd use AWT and then use Display.setParent() on an appropriate window.

So with that in mind would the simple inclusion of some hints about multimonitor usage not go quite a long way toward solving the main issues?
eg. org.lwjgl.opengl.Display.primaryDisplayOnly=true might attempt to force the Display to only consider the surface presented by the "primary monitor"

Cas :)
Title: Re: [BUG] DisplayModes in Archlinux with multiple Monitors
Post by: matheus23 on June 30, 2012, 10:40:08
It has gone further.

I'm having a new system now...

I'm only getting lots of display modes now.
But they all do not work. If I want to set the Display mode to them, and then want to make the window be fullscreen, it crashes. (Will include error log later, time pressure is on me...)

Having LWJGLXRandr=false (or sth like that...), makes all the display modes dissapear. Now I have only got the double-screen wide display mode, which is the only display mode actually working.

I have no Idea how to fix this. Propably impossible to fix, maybe driver bug, maybe the desktop configuration, I dont know.
Title: Re: [BUG] DisplayModes in Archlinux with multiple Monitors
Post by: princec on June 30, 2012, 11:36:35
That's Linux for you :)

Cas :)
Title: Re: [BUG] DisplayModes in Archlinux with multiple Monitors
Post by: matheus23 on June 30, 2012, 14:21:29
Quote from: princec on June 30, 2012, 11:36:35
That's Linux for you :)

Cas :)
-_-
Still better than windows. IMO of course. Don't wanna start a flame war. Having one in JGO already :P
Title: Re: [BUG] DisplayModes in Archlinux with multiple Monitors
Post by: andre-d on July 02, 2012, 22:59:45
Quote from: matheus23 on June 30, 2012, 10:40:08
It has gone further.

I'm having a new system now...

I'm only getting lots of display modes now.
But they all do not work. If I want to set the Display mode to them, and then want to make the window be fullscreen, it crashes. (Will include error log later, time pressure is on me...)

Having LWJGLXRandr=false (or sth like that...), makes all the display modes dissapear. Now I have only got the double-screen wide display mode, which is the only display mode actually working.

I have no Idea how to fix this. Propably impossible to fix, maybe driver bug, maybe the desktop configuration, I dont know.

If you want to fullscreen a single monitor you need to tell the window manager to do that with NetWM fullscreen.  That, or you need "meta resolutions" in your X11 config for either monitor (Nvidia does not do this by default).