Login  Register

Re: Jogl/Jogamp on Java 9 no compatible graphics context

Posted by Douglas Lyon on Dec 25, 2017; 12:57pm
URL: https://forum.jogamp.org/Jogl-Jogamp-on-Java-9-tp4038012p4038435.html

Well you know,
If the code looks like:
 public static void main(String[] args) {
        GraphicsConfiguration config =
                SimpleUniverse.getPreferredConfiguration();
    }
we will need more than
jogamp-fat.jar (right?)
In fact;
 final GraphicsEnvironment
                localGraphicsEnvironment
                = getLocalGraphicsEnvironment();
        final GraphicsDevice
                defaultScreenDevice
                = localGraphicsEnvironment.getDefaultScreenDevice();
        GraphicsConfiguration c[] = defaultScreenDevice
                .getConfigurations();
        for (int i = 0; i < c.length; i++) {
            System.out.println("gc:" + i + ":" + c[i]);
        }
        GraphicsConfiguration gc  = c[0];
        Canvas3D c3d = new Canvas3D(gc);
        System.out.println("done");
needs more than jogamp-fat.jar
Don't you need
vecmath.jar j3dutils.jar j3dcore.jar, at the very least?
If I have the correct versions of these things, what I get appears below.
Thanks!
 - Doug
 public static void main(String[] args) {
        testGc();
    }

    private static void testGc() {
        final GraphicsEnvironment
                localGraphicsEnvironment
                = getLocalGraphicsEnvironment();
        final GraphicsDevice
                defaultScreenDevice
                = localGraphicsEnvironment.getDefaultScreenDevice();
        GraphicsConfiguration c[] = defaultScreenDevice
                .getConfigurations();
        for (int i = 0; i < c.length; i++) {
            System.out.println("gc:" + i + ":" + c[i]);
        }
        GraphicsConfiguration gc  = c[0];
        Canvas3D c3d = new Canvas3D(gc);
        System.out.println("done");
    }
/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin/java -javaagent:/Applications/idea.app/Contents/lib/idea_rt.jar=62831:/Applications/idea.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/lyon/current/java/testHello/out/production/testHello:/Users/lyon/current/java/testHello/jars/jogamp-fat.jar:/Users/lyon/current/java/testHello/jars/j3dcore.jar:/Users/lyon/current/java/testHello/jars/j3dutils.jar:/Users/lyon/current/java/testHello/jars/vecmath.jar com.docjava.Main
gc:0:CGLGraphicsConfig[dev=1317015680,pixfmt=0]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by javax.media.j3d.JoglPipeline (file:/Users/lyon/current/java/testHello/jars/j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of javax.media.j3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.IllegalArgumentException: Canvas3D: GraphicsConfiguration is not compatible with Canvas3D
        at javax.media.j3d.Canvas3D.checkForValidGraphicsConfig(Canvas3D.java:945)
        at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:986)
        at com.docjava.Main.testGc(Main.java:29)
        at com.docjava.Main.main(Main.java:13)

An inability to construct a Canvas3D is a bit of a show stopper, isn't it?
Thanks!
 - D