Java3D

40 views
Skip to first unread message

Douglas Lyon

unread,
Nov 20, 2017, 7:31:32 AM11/20/17
to scijava
Hi All,
I was very pleased to get the following Java3D code to work with your branch. How can I find out who is working on the
org.scijava.java3d package?
Thanks!
 - Doug


import org.scijava.java3d.BranchGroup;
import org.scijava.java3d.Canvas3D;
import org.scijava.java3d.utils.geometry.ColorCube;
import org.scijava.java3d.utils.universe.*;

//import com.sun.j3d.utils.geometry.ColorCube;
//import com.sun.j3d.utils.universe.SimpleUniverse;

//import javax.media.j3d.BranchGroup;
//import javax.media.j3d.Canvas3D;
import java.awt.*;


public class StillCube {

public StillCube() {

GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();

Canvas3D c3d = new Canvas3D(config);


// SimpleUniverse is a Convenience Utility class
SimpleUniverse su = new SimpleUniverse(c3d);

// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
su.getViewingPlatform().setNominalViewingTransform();

su.addBranchGraph(getBranchGroup());
Frame f = new Frame();
f.setLayout(new BorderLayout());
Panel p = new Panel(new BorderLayout());
p.add(BorderLayout.CENTER, c3d);
f.add(p, BorderLayout.CENTER);
f.setSize(200,200);
f.setVisible(true);
} // end of HelloJava3Da (constructor)

public BranchGroup getBranchGroup() {
// Create the root of the branch graph
BranchGroup bg = new BranchGroup();
bg.addChild(new ColorCube(.25));
bg.compile();

return bg;
} // end of CreateSceneGraph method of HelloJava3Da

// The following allows this to be run as an application
// as well as an applet

public static void main(String[] args) {

System.setProperty("sun.java2d.noddraw","true");
System.setProperty("sun.awt.noerasebackground", "true");
StillCube cube = new StillCube();


}

} // end of class HelloJava3Da

Curtis Rueden

unread,
Nov 20, 2017, 2:00:41 PM11/20/17
to SciJava
Hi Doug,

> How can I find out who is working on the org.scijava.java3d package?

As stated in the project's README on GitHub [1]:

"This project is a temporary fork, until upstream Java 3D makes some progress."

The intent was not to continue development on Java 3D or a fork thereof, but rather to create a version with a new package prefix that does not clash with old versions of Java 3D, until the official Jogamp-maintained version of Java 3D 1.6.0 or 1.7.0 could be released. You can find all the discussion on the linked forum thread. Unfortunately, it seems the jogamp.org web site is down at the moment; hopefully it will be back soon.

I believe that the latest Jogamp version of Java 3D 1.7.0 can be found here:

(GitHub says it is a fork of hharrison/java3d-core, but the gouessej version is in fact the most up-to-date; the current maintainers are @philjord and @gouessej.)

I am not sure of the status of Java 3D 1.7.0 in general these days—would be good to ask on the Jogamp forum once jogamp.org comes back. Or you could try asking on #jogamp on irc.freenode.net if you don't want to wait.

In the meantime, you are welcome to use the org.scijava 1.6.0-scijava-2 versions of the artifacts. It's what we are using in ImageJ and Fiji [2] until/unless the Jogamp team releases something more official.

For future 3D visualization efforts, we are migrating away from Java 3D [3] in favor of Scenery [4]. The Jogamp team is also maintaining Java 3D only in "maintenance mode"—I'm sure they will be happy to accept bug-fix PRs, but the main purpose is for backwards compatibility with older applications.

Regards,
Curtis


--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


--
You received this message because you are subscribed to the Google Groups "scijava" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scijava+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Curtis Rueden

unread,
Nov 21, 2017, 12:24:45 PM11/21/17
to Dr. Douglas Lyon, SciJava
Hi Doug,

> To your knowledge, has there been much testing with jdk9 and the mac?
> So far, all of my system loads of jni libs have crashed the jdk9 jvm.

I just tried the 3D Viewer (built on the SciJava fork of Java 3D) with Fiji + Java 9.0.1 + High Sierra, and indeed for me it crashes the JVM. I pasted the native stack trace info as a gist here:


A Java-3D/Java-9 bug (maybe this bug, but maybe something else) was reported on the JogAmp forum:


With a quick web search, I didn't see a bug in the OpenJDK bug tracker matching my scenario, but it would probably be worthwhile to look a little harder.

Regards,
Curtis

P.S. Actually, the jogamp.org server _is_ online (you can see it by visiting http://144.76.84.101/); it is only the domain that is currently nonfunctional. Unfortunately, you cannot access forum.jogamp.org (I am guessing they use multiple virtual hosts from the same IP?).



--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Tue, Nov 21, 2017 at 6:09 AM, Dr. Douglas Lyon <ly...@docjava.com> wrote:
Hi Curtis,
Thank you for your fast response.
It is the case that www.jogamp.org appears down.
What a pity!

I gather, from the whois search, that Sven Gothel is the owner of the domain.

I sent Sven an e-mail (we do not know each other).

From what I can tell from:
https://github.com/gouessej/gluegen/tree/master/src/native
The team might benefit from someone with an interest in supporting the mac...but I would be happy to be wrong about that.
I am not an expert, by any means...however, I might be able to contribute something.

To your knowledge, has there been much testing with jdk9 and the mac?
So far, all of my system loads of jni libs have crashed the jdk9 jvm.

Thanks!
 - Doug




On 11/20/17 2:00 PM, Curtis Rueden wrote:
Hi Doug,

 > How can I find out who is working on the org.scijava.java3d package?

As stated in the project's README on GitHub [1]:

"This project is a temporary fork, until upstream Java 3D makes some progress."

The intent was not to continue development on Java 3D or a fork thereof, but rather to create a version with a new package prefix that does not clash with old versions of Java 3D, until the official Jogamp-maintained version of Java 3D 1.6.0 or 1.7.0 could be released. You can find all the discussion on the linked forum thread. Unfortunately, it seems the jogamp.org <http://jogamp.org> web site is down at the moment; hopefully it will be back soon.


I believe that the latest Jogamp version of Java 3D 1.7.0 can be found here:
https://github.com/gouessej/java3d-core

(GitHub says it is a fork of hharrison/java3d-core, but the gouessej version is in fact the most up-to-date; the current maintainers are @philjord and @gouessej.)

I am not sure of the status of Java 3D 1.7.0 in general these days—would be good to ask on the Jogamp forum once jogamp.org <http://jogamp.org> comes back. Or you could try asking on #jogamp on irc.freenode.net <http://irc.freenode.net> if you don't want to wait.
             Canvas3Dc3d  =new Canvas3D(config);



             // SimpleUniverse is a Convenience Utility class
    SimpleUniverse su =new SimpleUniverse(c3d);


             // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    su.getViewingPlatform().setNominalViewingTransform();

             su.addBranchGraph(getBranchGroup());
             Frame f =new Frame();

             f.setLayout(new BorderLayout());
             Panel p =new Panel(new BorderLayout());
             p.add(BorderLayout.CENTER,c3d);
             f.add(p, BorderLayout.CENTER);
             f.setSize(200,200);
             f.setVisible(true);
         }// end of HelloJava3Da (constructor)

    public BranchGroup getBranchGroup() {
             // Create the root of the branch graph
    BranchGroup bg =new BranchGroup();

             bg.addChild(new ColorCube(.25));
             bg.compile();

             return bg;
         }// end of CreateSceneGraph method of HelloJava3Da

    // The following allows this to be run as an application
    // as well as an applet

    public static void main(String[] args) {

             System.setProperty("sun.java2d.noddraw","true");
             System.setProperty("sun.awt.noerasebackground","true");
             StillCube cube =new StillCube();



         }

    }// end of class HelloJava3Da

    --     You received this message because you are subscribed to the Google
    Groups "scijava" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to scijava+unsubscribe@googlegroups.com

    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.


--
You received this message because you are subscribed to a topic in the Google Groups "scijava" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scijava/CKPVZ8Vgag8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scijava+unsubscribe@googlegroups.com <mailto:scijava+unsubscribe@googlegroups.com>.

Curtis Rueden

unread,
Nov 24, 2017, 10:51:17 PM11/24/17
to Dr. Douglas Lyon, SciJava
Hi Doug,

Just a quick note that jogamp.org is back online. It may be worth reporting your findings at forum.jogamp.org.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden


On Tue, Nov 21, 2017 at 1:20 PM, Dr. Douglas Lyon <ly...@docjava.com> wrote:
Hi Curtis,
I think I may be able to narrow down the issue;
jogl-all-natives-macosx-universal.jar

contains a jnilib that will crash when loaded into the jvm under jdk9.
For example:

  public static void main(String[] args) {

System.load("/Users/lyon/current/java/j4p/jars/j3d/foo/natives/macosx-universal/libnativewindow_awt.jnilib");
    }
Emits:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000117a0a795, pid=65766, tid=6915
#
# JRE version: Java(TM) SE Runtime Environment (8.0_51-b16) (build 1.8.0_51-b16)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.51-b03 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libawt_lwawt.dylib+0x44795]  JNI_OnLoad+0x91
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/lyon/current/java/j4p/hs_err_pid65766.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

The arch does appear correct:
file libnativewindow_awt.jnilib
libnativewindow_awt.jnilib: Mach-O universal binary with 2 architectures: [i386: Mach-O dynamically linked shared library i386] [x86_64: Mach-O 64-bit dynamically linked shared library x86_64]
libnativewindow_awt.jnilib (for architecture i386):     Mach-O dynamically linked shared library i386
libnativewindow_awt.jnilib (for architecture x86_64):   Mach-O 64-bit dynamically linked shared library x86_64


I think a rebuild might be in order to obtain a clean load on this jnilib.

The other libs load OK (as far as I can tell).

Thanks!
 - Doug


On 11/21/17 12:24 PM, Curtis Rueden wrote:
Hi Doug,

 > To your knowledge, has there been much testing with jdk9 and the mac?
 > So far, all of my system loads of jni libs have crashed the jdk9 jvm.

I just tried the 3D Viewer (built on the SciJava fork of Java 3D) with Fiji + Java 9.0.1 + High Sierra, and indeed for me it crashes the JVM. I pasted the native stack trace info as a gist here:



A Java-3D/Java-9 bug (maybe this bug, but maybe something else) was reported on the JogAmp forum:



With a quick web search, I didn't see a bug in the OpenJDK bug tracker matching my scenario, but it would probably be worthwhile to look a little harder.

Regards,
Curtis

P.S. Actually, the jogamp.org <http://jogamp.org> server _is_ online (you can see it by visiting http://144.76.84.101/); it is only the domain that is currently nonfunctional. Unfortunately, you cannot access forum.jogamp.org <http://forum.jogamp.org> (I am guessing they use multiple virtual hosts from the same IP?).




--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software

Did you know ImageJ has a forum? http://forum.imagej.net/


On Tue, Nov 21, 2017 at 6:09 AM, Dr. Douglas Lyon <ly...@docjava.com <mailto:ly...@docjava.com>> wrote:

    Hi Curtis,
    Thank you for your fast response.
    It is the case that www.jogamp.org <http://www.jogamp.org> appears down.
        <http://jogamp.org> <http://jogamp.org> web site is down at the

        moment; hopefully it will be back soon.

        I believe that the latest Jogamp version of Java 3D 1.7.0 can be
        found here:
        https://github.com/gouessej/java3d-core
        <https://github.com/gouessej/java3d-core>

        (GitHub says it is a fork of hharrison/java3d-core, but the
        gouessej version is in fact the most up-to-date; the current
        maintainers are @philjord and @gouessej.)

        I am not sure of the status of Java 3D 1.7.0 in general these
        days—would be good to ask on the Jogamp forum once jogamp.org
        <http://jogamp.org> <http://jogamp.org> comes back. Or you could

        try asking on #jogamp on irc.freenode.net
        <http://irc.freenode.net> <http://irc.freenode.net> if you don't

        want to wait.

        In the meantime, you are welcome to use the org.scijava
        1.6.0-scijava-2 versions of the artifacts. It's what we are
        using in ImageJ and Fiji [2] until/unless the Jogamp team
        releases something more official.

        For future 3D visualization efforts, we are migrating away from
        Java 3D [3] in favor of Scenery [4]. The Jogamp team is also
        maintaining Java 3D only in "maintenance mode"—I'm sure they
        will be happy to accept bug-fix PRs, but the main purpose is for
        backwards compatibility with older applications.

        Regards,
        Curtis

        [1] https://github.com/scijava/java3d-core#project-status
        <https://github.com/scijava/java3d-core#project-status>
        [2] https://imagej.net/
        [3] https://imagej.net/Java_3D
        [4] http://scenery.graphics/

        --
        Curtis Rueden
        LOCI software architect - https://loci.wisc.edu/software
        ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
        Did you know ImageJ has a forum? http://forum.imagej.net/


        On Mon, Nov 20, 2017 at 6:31 AM, Douglas Lyon
        <lyon.d...@gmail.com <mailto:lyon.d...@gmail.com>
        <mailto:lyon.d...@gmail.com <mailto:lyon.d...@gmail.com>>>
        <mailto:scijava%2Bunsubscribe@googlegroups.com>
             <mailto:scijava+unsubscribe@googlegroups.com
        <mailto:scijava%2Bunsubscribe@googlegroups.com>>.

             For more options, visit https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>
             <https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>>.


        --         You received this message because you are subscribed to a topic
        in the Google Groups "scijava" group.
        To unsubscribe from this topic, visit

        To unsubscribe from this group and all its topics, send an email
        to scijava+unsubscribe@googlegroups.com
Reply all
Reply to author
Forward
0 new messages