JTabbedPane Canvas3D bug

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

JTabbedPane Canvas3D bug

Julien
Dear List,

First off, a huge thanks to all of those who have kept this project alive. I am a developer from the Unidata IDV team (http://www.unidata.ucar.edu/software/idv/) and we have relied on this project for 10+ years for 3D visualization.

We have been using Java 3D (1.6.0-pre9-daily-experimental daily) on OS X and Java 7 with mostly good results, but we have come across a bug where the behavior of a
Java Swing object (javax.swing.JTabbedPane) is problematic when working with javax.media.j3d.Canvas3D objects. I have attempted to write a minimal example demonstrating this issue:

public class Bug extends JPanel {

    public Bug() {
        super(new GridLayout(1, 1));
        JTabbedPane tabbedPane = new JTabbedPane();
        JPanel      jp1        = new JPanel();
        jp1.setLayout(new BorderLayout());
        jp1.add(canvas3d(1.0f, 1.0f, 0.0f));
        JPanel jp2 = new JPanel();
        jp2.setLayout(new BorderLayout());
        jp2.add(canvas3d(0.0f, 1.0f, 1.0f));
        tabbedPane.addTab("Tab 1", jp1);
        tabbedPane.addTab("Tab 2", jp2);
        add(tabbedPane);
    }

    public static Canvas3D canvas3d(float arg0, float arg1, float arg2) {
        Canvas3D canvas =
            new Canvas3D(SimpleUniverse.getPreferredConfiguration());
        SimpleUniverse universe           = new SimpleUniverse(canvas);
        BranchGroup    root               = new BranchGroup();
        Appearance     polygon1Appearance = new Appearance();
        polygon1Appearance.setColoringAttributes(
            new ColoringAttributes(new Color3f(arg0, arg1, arg2), 1));
        QuadArray polygon1 = new QuadArray(4, QuadArray.COORDINATES);
        polygon1.setCoordinate(0, new Point3f(0f, 0f, 0f));
        polygon1.setCoordinate(1, new Point3f(5f, 0f, 0f));
        polygon1.setCoordinate(2, new Point3f(5f, 3f, 0f));
        polygon1.setCoordinate(3, new Point3f(0f, 3f, 0f));
        root.addChild(new Shape3D(polygon1, polygon1Appearance));
        universe.addBranchGraph(root);
        universe.getViewingPlatform().setNominalViewingTransform();
        return canvas;
    }

    private static void createAndShowGUI() {
        JFrame frame = new JFrame();
        frame.setPreferredSize(new Dimension(200, 200));
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(new Bug(), BorderLayout.CENTER);
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}

When running the Bug.java main application, you will note that switching back and forth between tabs works as expected on Java 3D 1.5 / Java 6 / OS X. However, switching between tabs in Java 3D 1.6 / Java 7 / OS X results in the image contained by the second tab getting stuck no matter what tab you are on.

Again, many thanks for your help.

-Julien
Reply | Threaded
Open this post in threaded view
|

Re: JTabbedPane Canvas3D bug

gouessej
Administrator
Hi

Yet another bug under Mac... :(

Thank you for the small test case, it will be helpful.

Your framework is interesting. I already knew Geocraft but I didn't know that there was a very good visualization framework for geoscience data based on Java3D.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JTabbedPane Canvas3D bug

Sven Gothel
Administrator
On 12/20/2013 10:13 AM, gouessej [via jogamp] wrote:
> Hi
>
> Yet another bug under Mac... :(
>
> Thank you for the small test case, it will be helpful.
>
> Your framework is interesting. I already knew Geocraft but I didn't know that
> there was a very good visualization framework for geoscience data based on
> Java3D.

I just fixed a regression since ]2.1.2 .. 2.1.3],
see http://forum.jogamp.org/Mac-Canvas3D-location-bug-tp4030052p4030948.html

Maybe its related ..

+++

On 12/18/2013 03:08 PM, jimmypag [via jogamp] wrote:
> Hi all,
>
> I did a test on mac today and I found that with new JOGL 2.1.3, the canvas3D
> shift is back.
>
> I made the test with java 1.7u45, java 1.6-pre9, JOGL 2.1.2: OK
> With java 1.7u45, java 1.6-pre9, JOGL 2.1.3, canvas3D is shifted.
>
> So it should come from new jogl 2.1.3. at least, there is a change.

Thank you for finding the regression!

It's fixed:
  <https://jogamp.org/bugzilla/show_bug.cgi?id=928>

and will be part of 2.1.4 ofc:

<https://jogamp.org/wiki/index.php/SW_Tracking_Report_Objectives_for_the_release_2.1.4>

+++



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

Re: JTabbedPane Canvas3D bug

Julien
Sven and Julien,

Thanks for looking into this. I downloaded the latest nightly autobuild (version=2.1.4-rc-20131219). (This project has nice continuous integration, BTW. Nice work). I note that the "stuck" image problem I describe above is fixed, but I encountered another problem. The code I submit here is almost the same as the code sample above, but the constructor is slightly different. In particular, the layout is changing from BorderLayout to BoxLayout for tab 1 and 2. Now after switching back and forth between tabs, the image eventually disappears on the second tab. (I had actually noticed this same problem in an earlier version of jogamp). This example works on Java 3D 1.5 / Java 6 / OS X.

    public Bug() {
        super(new GridLayout(1, 1));
        JTabbedPane tabbedPane = new JTabbedPane();
        JPanel      jp1        = new JPanel();
        jp1.setLayout(new BorderLayout());
        jp1.add(canvas3d(1.0f, 1.0f, 1.0f));
        JPanel jp2 = new JPanel();
        jp2.setLayout(new BoxLayout(jp2, BoxLayout.X_AXIS));
        jp2.add(canvas3d(1.0f, 1.0f, 1.0f));
        tabbedPane.addTab("Tab 1", jp1);
        tabbedPane.addTab("Tab 2", jp2);
        add(tabbedPane);
    }

Thanks again.

-Julien
Reply | Threaded
Open this post in threaded view
|

Re: JTabbedPane Canvas3D bug

Sven Gothel
Administrator
On 12/20/2013 07:19 PM, Julien [via jogamp] wrote:

> Sven and Julien,
>
> Thanks for looking into this. I downloaded the latest nightly autobuild
> (version=2.1.4-rc-20131219). (This project has nice continuous integration,
> BTW. Nice work). I note that the "stuck" image problem I describe above is
> fixed, but I encountered another problem. The code I submit here is almost the
> same as the code sample above, but the constructor is slightly different. In
> particular, the layout is changing from BorderLayout to BoxLayout for tab 1
> and 2. Now after switching back and forth between tabs, the image eventually
> disappears on the second tab. (I had actually noticed this same problem in an
> earlier version of jogamp). This example works on Java 3D 1.5 / Java 6 / OS X.
>
Since I don't test Java3D,
can you validate w/ our JOGL unit tests:

com.jogamp.opengl.test.junit.jogl.awt.TestBug816JTabbedPanelVisibilityB849B878AWT
com.jogamp.opengl.test.junit.jogl.awt.TestBug816GLCanvasFrameHoppingB849B889AWT

You may use scripts/tests.sh and tests-osx-x64.sh:
  cd jogl/make
  edit scripts/tests.sh <- enable one of the unit test
  edit scripts/tests-osx-x64.sh <- match your folders, i.e. 'build' path
  run tests-osx-x64.sh

Here both tests work fine.

Pls reply w/ your results .. thank you!

~Sven

>     public Bug() {
>         super(new GridLayout(1, 1));
>         JTabbedPane tabbedPane = new JTabbedPane();
>         JPanel      jp1        = new JPanel();
>         jp1.setLayout(new BorderLayout());
>         jp1.add(canvas3d(1.0f, 1.0f, 1.0f));
>         JPanel jp2 = new JPanel();
>         jp2.setLayout(new BoxLayout(jp2, BoxLayout.X_AXIS));
>         jp2.add(canvas3d(1.0f, 1.0f, 1.0f));
>         tabbedPane.addTab("Tab 1", jp1);
>         tabbedPane.addTab("Tab 2", jp2);
>         add(tabbedPane);
>     }
>
> Thanks again.
>
> -Julien


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

Re: JTabbedPane Canvas3D bug

Julien
Sven,

I git cloned jogl, gluegen, joal. I edited the scripts you describe above. The scripts complained about missing build-macosx directories (which is easy enough to fix, but I was not sure if it was indicative of a larger problem with the test scripts).  Here is the output of the test script:

https://gist.github.com/julienchastang/8085628

It looks like it is complaining about: dyld: Symbol not found: __cg_jpeg_resync_to_restart

Thanks again.

-Julien

Reply | Threaded
Open this post in threaded view
|

Re: JTabbedPane Canvas3D bug

Sven Gothel
Administrator
On 12/22/2013 06:23 PM, Julien [via jogamp] wrote:
> Sven,
>
> I git cloned jogl, gluegen, joal. I edited the script you describe below. The
> scripts complained about missing build-macosx directories (which is easy
> enough to fix, but I was not sure if it was indicative of a larger problem
> with the test scripts).  

As I wrote, you sure need to fix it so it matches gluegen and jogl build path,
default is 'build'. I use a rootrel path for each platform in one filesystem,
hence the 'build-macosx'.
> edit scripts/tests-osx-x64.sh <- match your folders, i.e. 'build' path

> Here is the output of the test script:
>
> https://gist.github.com/julienchastang/8085628

You use the right java binary it seems, but
some weird ImageIO dependency, I never experienced:

+++
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home//bin/java
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libJPEG.dylib
in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
+++

>
> It looks like it is complaining about: dyld: Symbol not found:
> __cg_jpeg_resync_to_restart
>

Dunno what that means .. sorry.

Maybe somebody can help out here ?

~Sven
 
> Thanks again.
>
> -Julien


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

Re: JTabbedPane Canvas3D bug

Julien
Sven,

The problem is changing the path of DYLD_LIBRARY_PATH breaks the test (http://mac-os-forge.2317878.n4.nabble.com/Incorrect-libjpeg-dylib-after-installing-ImageMagick-td134968.html). I simply commented out the  DYLD_LIBRARY_PATH line in scripts/tests-osx-x64.sh and got the tests working. You can find the results of the tests here:

https://gist.github.com/julienchastang/8178692

https://gist.github.com/julienchastang/8178713

Let me know if you need any more information from me.

Thanks again.

-Julien
Reply | Threaded
Open this post in threaded view
|

Re: JTabbedPane Canvas3D bug

Julien
Happy New Year All.

Is there anything further I can do to make progress on this issue after having run the tests described previously?

Thanks again,

-Julien
Reply | Threaded
Open this post in threaded view
|

Re: JTabbedPane Canvas3D bug

Sven Gothel
Administrator
On 01/06/2014 09:16 PM, Julien C [via jogamp] wrote:
> Happy New Year All.
>
> Is there anything further I can do to make progress on this issue after having
> run the tests described previously?
>

In regards to the test script - it's 'fixed' - thank you.

+++

<http://forum.jogamp.org/Java-7-Java3D-Borderlayout-problem-tp4031082p4031086.html>
<https://jogamp.org/bugzilla/show_bug.cgi?id=937#c2>

+++

Have you tested w/ latest aggregated build ?
  <http://jogamp.org/deployment/archive/master/gluegen_759-joal_509-jogl_1195-jocl_901/>

You can always check:
  <http://jogamp.org/deployment/archive/master/?C=M;O=D>

+++

Nevertheless .. I will re-check the TestAWTCardLayoutAnimatorStartStopBug532
and TestBug816JTabbedPanelVisibilityB849B878AWT test cases.

Pls do the same, thank you.

+++

--
health & wealth
mailto:[hidden email] ; http://jausoft.com
land : +49 (471) 4707742 ; fax : +49 (471) 4707741
Timezone CET: PST+9, EST+6, UTC+1


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

Re: JTabbedPane Canvas3D bug

Julien
Sven,

I cloned the latest from github.

Still seeing the same JTabbedPane Canvas3D bug.

I reran the tests with the latest:

https://gist.github.com/julienchastang/8344367
https://gist.github.com/julienchastang/8344385

FYI: When I run and watch the results, I don't seem to detect any anomalies like blank canvases. I wonder if they capture the bug I am seeing.

Since I can't figure out how to embed an image in this forum software, here is output of the code sample above:

https://gist.github.com/julienchastang/8344660

Thanks again,

-Julien
Reply | Threaded
Open this post in threaded view
|

Re: JTabbedPane Canvas3D bug

Sven Gothel
Administrator
On 01/10/2014 01:25 AM, Julien C [via jogamp] wrote:

> Sven,
>
> I cloned the latest from github.
>
> Still seeing the same JTabbedPane Canvas3D bug.
>
> I reran the tests with the latest:
>
> https://gist.github.com/julienchastang/8344367
> https://gist.github.com/julienchastang/8344385
>
> FYI: When I run and watch the results, I don't seem to detect any anomalies
> like blank canvases. I wonder if they capture the bug I am seeing.
>
> Since I can't figure out how to embed an image in this forum software, here is
> output of the code sample above:
>
> https://gist.github.com/julienchastang/8344660
Please test again w/ version mentioned below.

If this does not satisfy, I need to produce a test from your code
and triage for this new case.

Thank you.

~Sven

<http://forum.jogamp.org/Mac-Canvas3D-location-bug-tp4030052p4031189.html>:
+++

The JAWTWindow visibility tracking got put of hand,
i.e. too complicated, too many sideeffects.

See <https://jogamp.org/bugzilla/show_bug.cgi?id=937#c5>

I had to replace it with a much more simplified logic,
please test:

  maven: 2.1.4-rc-20140113

<http://jogamp.org/deployment/archive/master/gluegen_759-joal_509-jogl_1195-jocl_901/>

<http://jogamp.org/deployment/archive/master/gluegen_761-joal_511-jogl_1200-jocl_903-signed/>

Please report results.

+++



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

Re: JTabbedPane Canvas3D bug

Julien
Sven,

Excellent! This seems to have solved the problem both in our test application, and in the IDV. This is great news! We owe you big debt of gratitude.

-Julien