Multiple Java3d objects in same Application
Posted by lermontov on Dec 16, 2021; 7:02am
URL: https://forum.jogamp.org/Multiple-Java3d-objects-in-same-Application-tp4041545.html
Hello,
what is the right approach to create multiple Java3d objects in the same application but in different Canvas3d?
I have a situation with
- many tabs (10-20) in a JTabbedPane
- in each pane I have an own Java3D diagram
- all panes with diagrams are being created in parallel
- each pane creates its own SimpleUniverse, GraficConfiguration, BranchGroup, Canvas, it compiles etc.
- to be responsive, the pane creation is done in a separate worker thread, when this is done, the component with canvas is added to a tab (in EDT)
- during creation I cklicked on some tabs, here and there
Sometimes it worked well, but sometimes the GUI freezes and can only be closed by task killing;
When I create all components in EDT and not in many worker threads, the application stays not responsive during the creation time, I wait 15-30 seconds, then it works well without freezing of GUI;
I watched in JConsole: AWT (also EDT) was BLOCKED, and some other worker threads too; I suppose this happens, when a worker thread creates a Canvas and is getting the PreferredConfiguration() -> also getting something from EDT;
What is wrong?
Thanks a lot in advance.