Fullscreen on secondary monitor

classic Classic list List threaded Threaded
31 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Fullscreen on secondary monitor

elect
Hi,

I would need to fullscreen my application on the monitor where the application itself is currently running

glWindow.setFullscreen() goes always on the primary monitor, is it possible to have it on the secondary one?
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

gouessej
Administrator
Hi

Use NewtFactory to get a Display instance, then a Screen instance and after that create your GLWindow with this screen. A Screen instance might use several physical monitors which is not what you want.

Maybe Sven can explain it to you better than me.

@Sven, please can you fix the Java documentation so that the NEWT classes appear anew??
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

elect
Is it possible to detect during runtime the monitor the glWindow is in and then use that?
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

Sven Gothel
Administrator
On 08/19/2014 03:18 PM, elect [via jogamp] wrote:
> Is it possible to detect during runtime the monitor the glWindow is in and
> then use that?

Yes, NEWT Window has a getMainMonitor() method,
however, the window's screen instance must be realized already
to fetch all associated monitor devices.

Please check 'TestScreenMode01dNEWT' in our unit tests.

~Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

elect
Ok so

        final Display display = NewtFactory.createDisplay(null); // local display

        final Screen screen = NewtFactory.createScreen(display, 0); // screen 0

        glWindow = GLWindow.create(screen, glCapabilities);


If I write 0 is fine, if I write 1 then the frame will execute unfocused not in front and I need to explicitely click on the icon in the lower window bar

fullscreen goes always on the primary..
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

Sven Gothel
Administrator
On 08/26/2014 12:24 PM, elect [via jogamp] wrote:

> Ok so
>
>         final Display display = NewtFactory.createDisplay(null); // local display
>
>         final Screen screen = NewtFactory.createScreen(display, 0); // screen 0
>
>         glWindow = GLWindow.create(screen, glCapabilities);
>
>
> now?
glWindow.setVisible(true);

now!

You can also realize the 'screen' instance beforehand if you like
and query the screens monitor ahead of the glWindow realization
via addReference()/removeReference() _or_ createNative(), see unit tests.

Then you could query the main monitor via the screen instance using
getMainMonitor(RectangleImmutable).

In case this is for your VR stuff, in StereoDemo01 we simply use the
VR provided window coordinates.

~Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

BrickFarmer
In reply to this post by elect
elect wrote
If I write 0 is fine, if I write 1 then the frame will execute unfocused not in front and I need to explicitely click on the icon in the lower window bar

fullscreen goes always on the primary..
I think that is always the case with fullscreen mode, that it always goes to primary. In OSX you can drag the title bar in screen arrangement to nominate a new primary screen.  Alternative you can have a full size window that is undecorated on the second display.  I think though that for hardware rendering the first approach is the only way to go, or use mirroring.
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

elect
So, since I finally made it building JOGL I wanted to runt the TestScreenMode01aNEWT but I get some errors with the libs


ant -f D:\\Documents\\NetBeansProjects\\jogl\\nbproject\\ide-file-targets.xml -Drun.class=com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT run-selected-file-in-junit
init:
compile-test:
run-selected-file-in-junit:
Desired mode w/ resolution 800x600
JUnit version 4.11
Thread-1 - SISock: localhost/127.0.0.1:59999 - started
SLOCK [T main @ 1409812898922 ms +++ localhost/127.0.0.1:59999 - Locked within 1004 ms, 1 attempts
EE
Time: 3,146
There were 2 failures:
1) com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT
java.lang.UnsatisfiedLinkError: C:\Users\gbarbieri\AppData\Local\Temp\jogamp_0000\file_cache\jln5481176273947278611\jln5012067939510932583\gluegen-rt.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
SLOCK [T Thread-0 @ 1409812901059 ms XXX localhost/127.0.0.1:59999 - Kill @ JVM Shutdown
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
        at java.lang.Runtime.load0(Runtime.java:795)
        at java.lang.System.load(System.java:1062)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:575)
        at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
        at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:96)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:459)
        at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:388)
        at com.jogamp.common.os.Platform$1.run(Platform.java:209)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.common.os.Platform.<clinit>(Platform.java:179)
        at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:120)
        at com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT.initClass(TestScreenMode01aNEWT.java:89)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.junit.runners.Suite.runChild(Suite.java:127)
        at org.junit.runners.Suite.runChild(Suite.java:26)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
        at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
        at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
        at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
        at com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT.main(TestScreenMode01aNEWT.java:265)
2) com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT
java.lang.NoClassDefFoundError: Could not initialize class com.jogamp.common.os.Platform
        at javax.media.nativewindow.NativeWindowFactory$2.run(NativeWindowFactory.java:177)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.nativewindow.NativeWindowFactory.<clinit>(NativeWindowFactory.java:174)
        at com.jogamp.opengl.test.junit.util.UITestCase.resetXRandRIfX11(UITestCase.java:116)
        at com.jogamp.opengl.test.junit.util.UITestCase.oneTimeTearDown(UITestCase.java:250)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.junit.runners.Suite.runChild(Suite.java:127)
        at org.junit.runners.Suite.runChild(Suite.java:26)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
        at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
        at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
        at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
        at com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT.main(TestScreenMode01aNEWT.java:265)

FAILURES!!!
Tests run: 0,  Failures: 2

D:\Documents\NetBeansProjects\jogl\nbproject\ide-file-targets.xml:34: Java returned: 1
BUILD FAILED (total time: 3 seconds)


I dont get why it is looking for the gluegen-rt.dll in C:\Users\gbarbieri\AppData\Local\Temp\jogamp_0000\file_cache\jln5481176273947278611\jln5012067939510932583
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

Sven Gothel
Administrator
On 09/04/2014 08:45 AM, elect [via jogamp] wrote:
> So, since I finally made it building JOGL

probably for the wrong target ? See below ..

> I wanted to runt the
> TestScreenMode01aNEWT but I get some errors with the libs
>
>
> ant -f D:\\Documents\\NetBeansProjects\\jogl\\nbproject\\ide-file-targets.xml
> -Drun.class=com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT
> run-selected-file-in-junit
> init:
> compile-test:
> run-selected-file-in-junit:
> Desired mode w/ resolution 800x600
> JUnit version 4.11
> Thread-1 - SISock: localhost/127.0.0.1:59999 - started
> SLOCK [T main @ 1409812898922 ms +++ localhost/127.0.0.1:59999 - Locked within
> 1004 ms, 1 attempts
> EE
> Time: 3,146
> There were 2 failures:
> 1) com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT
> java.lang.UnsatisfiedLinkError:
> C:\Users\gbarbieri\AppData\Local\Temp\jogamp_0000\file_cache\jln5481176273947278611\jln5012067939510932583\gluegen-rt.dll:
> Can't load IA 32-bit .dll on a AMD 64-bit platform

IA == INTEL ITANIUM CPU



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

elect
Sven Gothel wrote
probably for the wrong target ? See below ..

Uhm, how can I set the target for the compiling?
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

elect
I am doing this

        GLProfile gLProfile = GLProfile.getDefault();

        GLCapabilities gLCapabilities = new GLCapabilities(gLProfile);

        Display display = NewtFactory.createDisplay(null);
       
        Screen screen = NewtFactory.createScreen(display, 0);
       
        glWindow = GLWindow.create(screen, gLCapabilities);


How can I choose the display where going fullscreen now?
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

gouessej
Administrator
You can use Screen.getAllScreens() to get all screens and the pick up the one that fits into your needs.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

elect
gouessej wrote
You can use Screen.getAllScreens() to get all screens and the pick up the one that fits into your needs.
Althought I didnt get how to pick up the one that I want, Screen.getAllScreens().size() returns 1 instead of 3, as many as I have.
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

Sven Gothel
Administrator
In reply to this post by gouessej
On 10/10/2014 04:59 PM, gouessej [via jogamp] wrote:
> You can use Screen.getAllScreens() to get all screens and the pick up the one
> that fits into your needs.

Probably not working in a 'big desktop' enviornment.

Here, you can query the monitors covered by the one screen,
and use those.

com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT

<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java;h=377c35ade46758f608aff329e5e9a9a6eb72121f;hb=HEAD#l129>

etc ..

~Sven


signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

elect
Sven Gothel wrote
On 10/10/2014 04:59 PM, gouessej [via jogamp] wrote:
> You can use Screen.getAllScreens() to get all screens and the pick up the one
> that fits into your needs.

Probably not working in a 'big desktop' enviornment.

Here, you can query the monitors covered by the one screen,
and use those.

com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT

<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java;h=377c35ade46758f608aff329e5e9a9a6eb72121f;hb=HEAD#l129>

etc ..

~Sven



signature.asc (828 bytes) <http://forum.jogamp.org/attachment/4033310/0/signature.asc>
screen.getMonitorDevices() is null (screen isnt)

Edit: forget it, I didnt use screen.addReference(). Ok now screen.getMonitorDevices().size() returns 3! :)
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

Sven Gothel
Administrator
On 10/10/2014 05:23 PM, elect [via jogamp] wrote:

>     Sven Gothel wrote
>     On 10/10/2014 04:59 PM, gouessej [via jogamp] wrote:
>     > You can use Screen.getAllScreens() to get all screens and the pick up
>     the one
>     > that fits into your needs.
>
>     Probably not working in a 'big desktop' enviornment.
>
>     Here, you can query the monitors covered by the one screen,
>     and use those.
>
>     com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT
>
>     <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java;h=377c35ade46758f608aff329e5e9a9a6eb72121f;hb=HEAD#l129>
>     <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java;h=377c35ade46758f608aff329e5e9a9a6eb72121f;hb=HEAD#l129%3E>
>
>     etc ..
>
>     ~Sven
>
>
>
>     signature.asc (828 bytes)
>     <http://forum.jogamp.org/attachment/4033310/0/signature.asc>
>     <http://forum.jogamp.org/attachment/4033310/0/signature.asc%3E>
>
> screen.getMonitorDevices() is null (screen isnt)
use above demo please, maybe your screen hasn't been created yet ?

~Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

elect
Sven Gothel wrote
use above demo please, maybe your screen hasn't been created yet ?

~Sven




signature.asc (828 bytes) <http://forum.jogamp.org/attachment/4033312/0/signature.asc>
I could never solve the problems to have the demos running..
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

Sven Gothel
Administrator
On 10/10/2014 05:55 PM, elect [via jogamp] wrote:

>     Sven Gothel wrote
>     use above demo please, maybe your screen hasn't been created yet ?
>
>     ~Sven
>
>
>
>
>     signature.asc (828 bytes)
>     <http://forum.jogamp.org/attachment/4033312/0/signature.asc>
>     <http://forum.jogamp.org/attachment/4033312/0/signature.asc%3E>
>
> I could never solve the problems to have the demos running..
we surely speak a different language, cannot grok your statement.

maybe you _read_ the demo then :)



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

gouessej
Administrator
In reply to this post by elect
Sorry. I think that we should write a page in the wiki about that as several people already ask some questions about that:
screen = virtual monitor
monitor = physical monitor

In a big desktop environment, you can use multiple physical monitors to make a single virtual monitor.

The link was broken, it's better now:
http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java;h=377c35ade46758f608aff329e5e9a9a6eb72121f;hb=HEAD#l129

Please use this method with the Monitor you'd like to use:
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/opengl/GLWindow.html#setFullscreen(java.util.List)

Let me know whether it's not accurate enough and keep cool, we're here to help you ;)

Edit.: You can pass a list containing a single monitor.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fullscreen on secondary monitor

elect
Sven Gothel wrote
we surely speak a different language, cannot grok your statement.

maybe you _read_ the demo then :)
:D I meant I never solved the problem I had while trying to run the jogl demos.. I refer for example to the library issue, where jogl is looking for dll in a very strange directory and is looking the IA architecture version..

Anyway, since I couldnt run them, I did read them, that's why I found the addReference() missing..

gouessej wrote
Sorry. I think that we should write a page in the wiki about that as several people already ask some questions about that:
screen = virtual monitor
monitor = physical monitor

In a big desktop environment, you can use multiple physical monitors to make a single virtual monitor.

The link was broken, it's better now:
http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java;h=377c35ade46758f608aff329e5e9a9a6eb72121f;hb=HEAD#l129

Please use this method with the Monitor you'd like to use:
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/opengl/GLWindow.html#setFullscreen(java.util.List)

Let me know whether it's not accurate enough and keep cool, we're here to help you ;)

Edit.: You can pass a list containing a single monitor.
Yeah, a wiki would be very very useful.

Anyway, it seems it is working now

        screen = NewtFactory.createScreen(display, 0);

        screen.addReference();

        glWindow = GLWindow.create(screen, gLCapabilities);

        List<MonitorDevice> monitorDevices = new ArrayList<>();
        monitorDevices.add(screen.getMonitorDevices().get(i));
        glWindow.setFullscreen(monitorDevices);

I can have the fullscreen on the i-th monitor I want :)

Just few considerations:

- the keyListener doesnt work anymore now at fullscreen, but I will investigate something more on this, maybe it is my fault

- addReference() takes a lot of time, more than 10s, is it normal?

- I always found the jogl forum crap. Dont get me wrong, I am not blaming you guys for the work you do for free and all the effort you put in it. I thank you all for everything you did up today. I want you to not get this like a critic, but rather as an improvement/suggest.
I just think a modern forum would: increase the success of jogl platform, make it appear more modern and updated with our current times. I attend different forums, many of them as a lot of useful features, for example a much better support for the quote, multiquote, thanks to the author of a post, link for going to the first unread message, a much nicer good looking, (better) supports for code, quote, links, images, videos, etc etc.
This is one I think is one of the best out there (http://www.invisionpower.com/apps/board/), but it is just an example.
I say this because I use and love jogl, so helping make it better is all in my interest :)
12