JOGL in JAVAFX error with jnlp on mac only

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

JOGL in JAVAFX error with jnlp on mac only

valerie
Hello,

I have a really strange error, it happens only on Mac when I execute my program via my jnlp :

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at java.awt.Rectangle.setBounds(Rectangle.java:337)
        at javax.swing.RepaintManager.collectDirtyComponents(RepaintManager.java:919)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:802)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:789)
        at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:738)
        at javax.swing.RepaintManager.access$1200(RepaintManager.java:64)
        at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1732)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
        at java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:709)
        at java.awt.EventQueue$3.run(EventQueue.java:703)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
java.lang.reflect.InvocationTargetException
        at java.awt.EventQueue.invokeAndWait(EventQueue.java:1321)
        at java.awt.EventQueue.invokeAndWait(EventQueue.java:1296)
        at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1348)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:98)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
        at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.NullPointerException
        at java.awt.Rectangle.setBounds(Rectangle.java:337)
        at javax.swing.RepaintManager.collectDirtyComponents(RepaintManager.java:919)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:802)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:789)
        at com.jogamp.opengl.util.AWTAnimatorImpl$1.run(AWTAnimatorImpl.java:170)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
        at java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:709)
        at java.awt.EventQueue$3.run(EventQueue.java:703)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

When I run my program locally in NetBeans everything is fine, the 3D is really smooth. But when I package my program to run it online, these logs are appearing and the 3D is buggy.

My program is a JavaFX application. I instanciate à GLJpanel in a SwingNode. I'm using a FPSAnimator to start the display loop.

I'm lost... I do not know how to fix it :( Can someone help me ?

I did not found a lot of documentation about embedding à jogl canvas in a javafx application.

++
Valérie
Reply | Threaded
Open this post in threaded view
|

Re: JOGL in JAVAFX error with jnlp on mac only

gouessej
Administrator
Hi

Please provide a SSCCE to help us to reproduce your bug. We aren't responsible of JavaFX and AWT, we do our best. There is no need to write lengthy documentation about embedding AWT GLCanvas and Swing GLJPanel into OpenJFX/JavaFX as using a SwingNode should work. Maybe the culprit is Java Webstart itself. I advise you to run your software outside of Netbeans without Java Webstart under OS X to check whether the problem comes from it.

There is a bug report about JavaFX in our bug tracker, I advise you to read it in order to understand the known limitations especially under Windows.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL in JAVAFX error with jnlp on mac only

gouessej
Administrator
In reply to this post by valerie
Maybe the operating system picks another version of Java when running your software with Java Webstart. Ensure that Apple JRE isn't installed on your computer. Which version of Java do you use?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL in JAVAFX error with jnlp on mac only

valerie
My issue is really only with webstart on mac os. When I run the app in commanline, everything is fine.

I checked the java version : jdk 1.8.0_121 on development mode and jre 1.8.0_121 for javaws.

I just read this warning message : https://java.com/fr/download/faq/sierra_java.xml
It's about NPE on Mac OS Sierra.

Do you think it could be the same issue ?
Reply | Threaded
Open this post in threaded view
|

Re: JOGL in JAVAFX error with jnlp on mac only

valerie
In reply to this post by gouessej
thanks for your response :)
Do you mean this ticket : https://jogamp.org/bugzilla/show_bug.cgi?id=607 ?
Yes I read it, but there is nothing new since 2015. I choose to use a GLJPanel which seems to be the best solution in my case.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL in JAVAFX error with jnlp on mac only

gouessej
Administrator
I'm not 100% sure but in my humble opinion, it's not the same problem. Do you reproduce this bug with a rudimentary test case under OS X with Java Webstart? Please try this one:
http://jogamp.org/deployment/jogamp-next/jogl-application-version.jnlp

I try to determine whether OpenJFX/JavaFX is involved in your bug.

Yes there is nothing new since 2015 as almost nothing has changed in the meantime but we're not to blame as OpenJFX/JavaFX is an Oracle API which is obviously not a part of JogAmp. There is still no public API to interact with some parts of OpenJFX/JavaFX, especially Prism, Quantum and the Glass Toolkit. That's why an equivalent of GLJPanel for OpenJFX/JavaFX cannot be safely created yet.

Is Java Webstart necessary for your project? Maybe there is another solution. I don't think about applets. There's JavaFX native deployment:
http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm

If your project is under GPL, feel free to use JNDT.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL in JAVAFX error with jnlp on mac only

valerie
jogl-application-version.jnlp is fine, no exception with this jnlp.
But is there an Animator in this program ?

I made some tests :
This jnlp show a rudimentary 3D : http://taesch.fr/jfx-jogl/jfx-jogl-light.jnlp
And this one do not show any 3D but the exception is still present in the logs : http://taesch.fr/jfx-jogl/jfx-jogl-soutonly.jnlp
I just put some System.out.println in my init, reshape and display methods.

Here my SwingNode implementation : https://we.tl/IXIzDBIzMn
JavaFX initialize my SwingNode in the fxml :
<GridPane xmlns:fx="http://javafx.com/fxml" fx:controller="com.booa.designer.controller.editionprojet.vue3d.Pane3DController">
    <Fenetre3DFX fx:id="fenetre3D" GridPane.hgrow="always" GridPane.vgrow="always"/>       
</GridPane>

I need to use java web start because I need to update my jar easily without having anything to do on the user computer.

Thanks for your help !


Reply | Threaded
Open this post in threaded view
|

Re: JOGL in JAVAFX error with jnlp on mac only

gouessej
Administrator
There is no animator in this program. There is an animator in this one:
http://jogamp.org/deployment/jogamp-current/jogl-demos/Gears.jnlp

Please can you put your source code temporarily here? It would be even better if you took the time to create a bug report.

You can simply use curl, wget or the JRE itself to update your JAR before running your software, by doing it inside the launch script so that the end user doesn't have to do it. I did something similar under Windows in Powershell + .NET a few weeks ago, it's doable with bash under GNU Linux and OS X as well. Applets are deprecated in Java 1.9 and will be removed from Java 1.10; Java Deployment Toolkit is already no longer working in some web browsers (especially MSIE) and Java Webstart will probably be abandoned too. If your bug occurs only in Java Webstart with JavaFX whereas the former will die and the latter is too difficult to support, there will be a very few chances for me to reproduce and fix this bug. Moreover, I cannot use OpenJFX/JavaFX at home yet, there is no OpenJFX build for my GNU Linux distribution yet :s

Do you reproduce this bug under Windows? I'll give a try to your rudimentary 3D tests tomorrow.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL in JAVAFX error with jnlp on mac only

gouessej
Administrator
In reply to this post by valerie
There is a mistake in your source code, you should replace new GLU() by GLU.createGLU(GL). The rest looks ok. It runs correctly under Windows. Your bug seems to be specific to OS X.
Julien Gouesse | Personal blog | Website