[vtkusers] vtk 5.10.1, vtkCanvas, SWT/AWT : app hangs when vtkorientationmarkerwidget/vtkaxesactor added and/or gradient background enabled

Gerrick Bivins Gerrick.Bivins at halliburton.com
Thu Jun 13 09:32:05 EDT 2013


I went to implement this and was expecting to hook to an event/command to get notification of the vtkRenderWindowInteractor
state change (Initialized,Started) but there don't seem to be any. In fact, there aren't many notifications of state changes to the interactor or the vtkRenderWindow.
Have I overlooked something?

From: Sebastien Jourdain [mailto:sebastien.jourdain at kitware.com]
Sent: Wednesday, June 12, 2013 2:58 PM
To: Gerrick Bivins
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] vtk 5.10.1, vtkCanvas, SWT/AWT : app hangs when vtkorientationmarkerwidget/vtkaxesactor added and/or gradient background enabled

Hi Gerrick,

I don't know which version of VTK you are using, but if you are using the latest release (still in RC),
you have a proper SWT renderering component that may work slightly better.

Although, one thing that could be the issue here is that some of the methods that you call (the one that dead lock) internally generate the render window while that one is not visible in the Java/SWT context.
What I'm saying is you may need to do your setup in 2 steps. First step, setup the UI container and then 'later', once the graphical component is visible, intialize the VTK renderer the way you want.

Seb

On Wed, Jun 12, 2013 at 12:21 PM, Gerrick Bivins <Gerrick.Bivins at halliburton.com<mailto:Gerrick.Bivins at halliburton.com>> wrote:
Hi All,
I have an application that embeds an AWT canvas, vtkCanvas, in an SWT Composite using the SWT_AWT bridge.
The issue I'm having has only shown itself on one machine but the symptoms are really strange.
Basically, if I follow all the rules about creating actors, modifying the pipeline etc as described here:
http://www.vtk.org/Wiki/VTK/Java_Wrapping#Threading_Sample_Code_.28from_VTK.2FWrapping.2FJava.2Fvtk.2Fsample.2FDemo.java.29

it's all gravy.

However, on a particular machine I have two issues:

1)      if I turn on a gradient background as described here:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/BackgroundGradient

the app locks up. I enable it by calling vtkRenderer.GradientBackgroundOn()  so I'm not sure if I can

make this call in a java application and where it's valid to do so because the native code is

doing more than just setting the "GradientBackground" variable.

2)      Similar but different, if I add a vtkAxesActor to the renderer, it cannot be enabled until some time later. Ambiguous, I know!!!

Basically, if I set up the code similar to this example:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/DisplayCoordinateAxes

the calls to widget.SetEnabled(1) causes the application to hang. If I set it to widget.SetEnabled(0)
               and then sometime later (not sure the condition here for what is "later")toggle it on. It works as expected.

Everything is setup to check for the EDT and execute properly on the EDT or invokeLater on the EDT so it doesn't seem like that's the issue.
As I've stated earlier, this setup works on most machines but we ran into a case where, it fails.
What I've noticed when it hangs is that there are two AWT Event threads(0 and 1) and it looks like a window pops up external to the SWT composite.
Then it tries to pull (or create another one) and put it in the composite. On the 4 or 5 machines we internally tested on
it wasn't noticeable and succeeded but on the failing machine, it was more obvious and seem to freeze here.

Long post, but if anyone has any advice here, it would be greatly appreciated. One confusing thing is that I don't know when the
vtkRenderwindowinteractor methods are triggered (Start,Initialize) .It's "state" at any time is confusing to me when going through the vtkCanvas/vtkPanel
Java layer.

Gerrick



________________________________
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130613/a0a50955/attachment.htm>


More information about the vtkusers mailing list