Multiple Java3d objects in same Application

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

Multiple Java3d objects in same Application

lermontov
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.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple Java3d objects in same Application

gouessej
Administrator
Hello

In my humble opinion, despite the problem of performance, creating everything on the EDT is the right approach.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Multiple Java3d objects in same Application

runiter
In reply to this post by lermontov
I also have multiple tabs in my application but instead of creating multiple Canvas3D, I created a single Canvas3D. When the user changes table, I simply use a Java3D SwitchGroup to switch to different graphs. It's faster and consumes less memory this way.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D