Impossible to retrieve the current mode until GLWindow is visible

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

Impossible to retrieve the current mode until GLWindow is visible

gouessej
Administrator
Hi

When I call Screen.getCurrentScreenMode() on the screen used by the GLWindow before it becomes visible, I get that:
Exception in thread "main" java.lang.InternalError: ScreenModeStatus.getScreenModeStatus(.x11_:0-1-s0) == null
        at jogamp.newt.ScreenImpl.getScreenModeStatus(ScreenImpl.java:328)
        at jogamp.newt.ScreenImpl.getCurrentScreenMode(ScreenImpl.java:340)
        at com.jme3.system.jogl.JoglNewtDisplay.applySettings(JoglNewtDisplay.java:131)
        at com.jme3.system.jogl.JoglNewtDisplay.createGLFrame(JoglNewtDisplay.java:64)
        at com.jme3.system.jogl.JoglNewtDisplay.privateInit(JoglNewtDisplay.java:142)
        at com.jme3.system.jogl.JoglNewtDisplay.create(JoglNewtDisplay.java:163)
        at com.jme3.app.Application.start(Application.java:390)
        at com.jme3.app.Application.start(Application.java:367)
        at com.jme3.app.SimpleApplication.start(SimpleApplication.java:130)
        at jme3test.input.TestCameraNode.main(TestCameraNode.java:63)

Is it the expected behaviour?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Impossible to retrieve the current mode until GLWindow is visible

Sven Gothel
Administrator
On 12/01/2012 09:52 AM, gouessej [via jogamp] wrote:

> Hi
>
> When I call Screen.getCurrentScreenMode() on the screen used by the GLWindow
> before it becomes visible, I get that:
> Exception in thread "main" java.lang.InternalError:
> ScreenModeStatus.getScreenModeStatus(.x11_:0-1-s0) == null
>         at jogamp.newt.ScreenImpl.getScreenModeStatus(ScreenImpl.java:328)
>         at jogamp.newt.ScreenImpl.getCurrentScreenMode(ScreenImpl.java:340)
>         at
> com.jme3.system.jogl.JoglNewtDisplay.applySettings(JoglNewtDisplay.java:131)
>         at
> com.jme3.system.jogl.JoglNewtDisplay.createGLFrame(JoglNewtDisplay.java:64)
>         at
> com.jme3.system.jogl.JoglNewtDisplay.privateInit(JoglNewtDisplay.java:142)
>         at com.jme3.system.jogl.JoglNewtDisplay.create(JoglNewtDisplay.java:163)
>         at com.jme3.app.Application.start(Application.java:390)
>         at com.jme3.app.Application.start(Application.java:367)
>         at com.jme3.app.SimpleApplication.start(SimpleApplication.java:130)
>         at jme3test.input.TestCameraNode.main(TestCameraNode.java:63)
>
> Is it the expected behaviour?
Yes, since NEWT favors lazy native creation (like JOGL etc).
This allows one to have the Java objects floating around w/o an actual native counterpart (window, GL ctx, ..) until 1st use.

Here I have described how to use ScreenMode before window creation:
  <http://forum.jogamp.org/Centering-a-Newt-window-td4026458.html#a4026504>
It's also available in one of the *ScreenMode* unit tests.

~Sven




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

Re: Impossible to retrieve the current mode until GLWindow is visible

gouessej
Administrator
This post was updated on .
Sven Gothel wrote
Here I have described how to use ScreenMode before window creation:
  <http://forum.jogamp.org/Centering-a-Newt-window-td4026458.html#a4026504>
It's also available in one of the *ScreenMode* unit tests.
Ok but can I just call GLWindow.getScreen().addReference() before GLWindow.setVisible(true) to achieve that in my case? Is it the right way of using a Screen instance?

Edit.: It works fine, see change 10016 in JMonkeyEngine 3.0.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Impossible to retrieve the current mode until GLWindow is visible

Sven Gothel
Administrator
On 12/01/2012 10:22 AM, gouessej [via jogamp] wrote:

>     Sven Gothel wrote
>     Here I have described how to use ScreenMode before window creation:
>      
>     <http://forum.jogamp.org/Centering-a-Newt-window-td4026458.html#a4026504>
>     <http://forum.jogamp.org/Centering-a-Newt-window-td4026458.html#a4026504%3E>
>     It's also available in one of the *ScreenMode* unit tests.
>
> Ok but can I just call GLWindow.getScreen().addReference() before
> GLWindow.setVisible(true) to achieve that in my case? Is it the right way of
> using a Screen instance?
As long you remove the reference afterwards (at best after window visibility
to avoid a redundant lifecycle) your lifecycle would be complete.

Otherwise the Screen and it's Display would be kept open .. I guess I have
described it in this thread - and it's visible in the unit tests.

In the end - your choice ofc.

~Sven




signature.asc (909 bytes) Download Attachment