Login  Register

JCanvas3D on OSX Java 7

Posted by joshP on Apr 18, 2013; 9:16am
URL: https://forum.jogamp.org/JCanvas3D-on-OSX-Java-7-tp4028980.html

I anyone using a JCanvas3D on Mac java 7?
I'm writing a netbeans platform app and I'm getting the offset problems that other people have been experiencing with a straight Canvas3D so I'm trying to use a JCanvas3D to render offscreen. The problem I'm having is that when the offscreen buffer is read back from openGL the alpha values are all set to 0. The colour components of the buffer are correct (the scene seems to have been drawn properly), but when I draw it to the screen nothing gets drawn since the alpha channel is empty.

I'm not doing any manual choosing of pixel formats or anything - just using a minimal Java3D hello world :
---------------------------------------------------------------------------
BranchGroup bg = new BranchGroup();
        ColorCube cube = new ColorCube(0.4f);
        bg.addChild(cube);

         // background colour
        Background background = new Background(new Color3f(0f, 1f, 0));        
        background.setApplicationBounds(sphere);
        bg.addChild(background);

// JCanvas
        JCanvas3D jCanvas = new JCanvas3D();
        //jCanvas.setResizeMode(JCanvas3D.RESIZE_IMMEDIATELY);
        this.add("Center", jCanvas);
        Dimension dim = new Dimension(100, 100);
        jCanvas.setPreferredSize(dim);
        jCanvas.setSize(dim);

        Canvas3D c = jCanvas.getOffscreenCanvas3D();

        SimpleUniverse u = new SimpleUniverse(c);
        u.getViewingPlatform().setNominalViewingTransform();
        bg.compile();
        u.addBranchGraph(bg);

---------------------------------------------------------------------------

I've traced it through and the data actually being returned in JoglPipeline.readOffscreenBuffer already has the alpha set to 0. The setup for the readPixels operation looks ok, so I'm assuming the issue must be in the original creation of the GL context or something?

I'm using the latest Java3D compiled from the trunk in Github and the "2.0.2-rc20130404" version of Jogl pushed to maven recently which claimed to have sorted out all Mac Java 7 issues.

Any ideas?