LWJGL Forum

Programming => OpenGL => Topic started by: josegil on November 25, 2008, 07:54:23

Title: Fullscreen dual monitor
Post by: josegil on November 25, 2008, 07:54:23
I'm trying to create an application for dual monitor fullscreen, but it said the resolution is invalid, because it return the physical.

The idea is to draw in the virtual device screen and not in the physical. What I can do it?
Title: Re: Fullscreen dual monitor
Post by: wolf_m on November 25, 2008, 08:46:46
I've got a similar issue on Linux with a virtual screen that also encapsules both physical screens - I'm doing this via TwinView.

TwinView reports a screen size LWJGL just doesn't accept for fullscreen (2560x1024).

What I do to handle this is I just don't do fullscreen, I go windowed. But that introduces other problems, like vsynching for different frequencies resulting in tearing on one display.
Anyway, if you choose a window size that matches your 2 monitors' combined width and height and then account for the window decoration to set a location, you've got a display spanning both screens.
Accounting for window decoration is kind of hard though.. Their dimensions are obviously different all the time. And stuff that's always on top, like for example taskbars, are an issue.

Maybe there's a consistent way to get rid of window decoration altogether for all platforms.
I suspect that one way could be using AWTGLCanvas in a Swing window that doesn't have decorations.

I'd also be interested in a non-hacky way for fullscreen on a virtual screen OR for getting rid of window decorations sans AWTGLCanvas (meaning doing it via Display).

But I suspect that in the end, if you've got a virtual screen, there's no perfect way to go fullscreen. Please, someone, prove me wrong here..
Title: Re: Fullscreen dual monitor
Post by: Kai on January 11, 2009, 10:02:10
Hi,

I too have this issue with having 2 GraphicsDevice's with TwinView on ubuntu.
I can enable fullscreen with a AWTGLCanvas in a JFrame with the AWT exclusive fullscreen mode on each separate GraphicsDevice, but to be honest, this solution is not optimal because the event handler in AWT is the actual bottleneck in that kind of configuration.
I looked into it with JProfiler and found that the EventDispatcherThread.run allocates tons of memory.
So I too would be interested in a solution of how to do fullscreen when having one X-server and multiple GraphicsDevice's.

Here is how I do fullscreen with JFrames:

        GraphicsEnvironment ge = GraphicsEnvironment
                .getLocalGraphicsEnvironment();
        GraphicsDevice[] gs = ge.getScreenDevices();
        for (int j = 0; j < gs.length; j++) {
            GraphicsDevice gd = gs[j];
            DisplayMode dm = gd.getDisplayMode();
            JFrame f = new JFrame(gs[j].getDefaultConfiguration());
            GraphicsConfiguration[] gcs = gd.getConfigurations();
            Canvas c = new Canvas(gd.getDefaultConfiguration());
            f.getContentPane().add(c);
            f.setUndecorated(true);
            System.out.println(gd.isFullScreenSupported());
            if (gd.isDisplayChangeSupported()) {
                gd.setDisplayMode(dm);
            }
            gd.setFullScreenWindow(f);
        }


That creates separate windows in fullscreen mode on each display.