[vtkusers] AWT + SWT + Event Loops (was Re: VTK6 and Java Cone Example 5)

Sebastien Jourdain sebastien.jourdain at kitware.com
Wed Aug 14 09:41:37 EDT 2013


Just read the sample codes that are provided in the vtk.jar or in the
Source code under Wrapping/Java/vtk/sample, they should be pretty strait
forward.
Moreover, VTK do provide a SWT component for rendering if you build it, so
you shouldn't have any event loop issue...

Seb


On Wed, Aug 14, 2013 at 9:30 AM, Ric Wright <rkwright at geofx.com> wrote:

> So did some more spelunking and it looks like this is just a basic
> incompatibility for SWT and AWT – in the specific case where AWT is trying
> to start their own event loop once SWT has started.  Previously, in my
> other work, I handled events on my own – I didn't ask or expect AWT to
> start or manage it's own events. I used AWT basically to host the OpenGL
> canvas (based on JOGL).  But when one invokes the vtkRenderWIndowInteractor
> an event loop IS spawned and the causes various weird problems.
>
> There is a fairly long summary of some of the issues here:
>
> http://marc.info/?l=openjdk-awt-dev&m=135818602009136&w=2
>
> So the question that comes to my mind is how dependent is the rest of VTK
> on starting its own event loops?  I.e. Can I use the rest of VTK and its
> pipeline to perform graphics, manage datasets, etc.  I am willing to give
> up the Interactor and its mimicking of trackball if everything else is
> likely to work.  But if spawning its own event loop(s) is intrinsic to how
> most of VTK works then I'm probably dead in the water.
>
> Thoughts or suggestions?
>
> Thanks
> Ric
>
>
> From: Ric Wright <rkwright at geofx.com>
> Date: Tuesday, August 13, 2013 12:59 PM
> To: Sebastien Jourdain <sebastien.jourdain at kitware.com>
> Cc: Sean McBride <sean at rogue-research.com>, vtkusers <vtkusers at vtk.org>
> Subject: Re: [vtkusers] VTK6 and Java Cone Example 5
>
> An update on this.  I ported over some of my other Eclipse work and
> adapted it to VTK.  It is pushed to my account on github and there is a
> writeup here:  http://rkwright.github.io/geofx-pages/vtkview.html.  There
> are 3 articles in there.  The latest rev of the code is here:
> https://github.com/rkwright/vtkscene in the develop branch.
>
> Mostly, it works great.  However, when I tried the fifth cone example,
> which has the problematic vtkRenderWindowInteractor, I ran into similar
> problems as before.  I instantiated it with a valid vtkPanel.RenderWindow
> but it still goes off into the ozone, sometimes crashing the native
> vtkOpenGL dylib.
>
> I'm going to skip the interactor for now and move on to see if I run into
> more problems. If not, I can probably live without that widget but the
> problems there might be symptomatic of deeper problems on OSX 64 bit
> systems.
>
> Any further suggestions would be welcome.
>
> Thanks
> Ric
>
>
> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
> Date: Tuesday, August 6, 2013 8:56 AM
> To: Ric Wright <rkwright at geofx.com>
> Cc: Sean McBride <sean at rogue-research.com>, vtkusers <vtkusers at vtk.org>
> Subject: Re: [vtkusers] VTK6 and Java Cone Example 5
>
> In Java you should use the Java specific classes anyway like
> vtkPanel/vtkCanvas or the new version of them used in the vtk.sample
> package of the vtk.jar...
>
> The purpose of those example was to show the possible match between the
> different languages...
>
> Nothing more I believe,
>
> Seb
>
>
> On Tue, Aug 6, 2013 at 8:52 AM, Ric Wright <rkwright at geofx.com> wrote:
>
>> Ah, OK.  Well, I don't know what to do here.  Is this happening to others?
>>  Should I file a bug?  Just try to work around it by not using
>> RenderWindowInteractors (sounds kind of lame).  Or?
>>
>> Suggestions?
>>
>> Thanks
>> Ric
>>
>>
>> On 8/5/13 4:15 PM, "Sean McBride" <sean at rogue-research.com> wrote:
>>
>> >On Mon, 5 Aug 2013 16:10:55 -0500, Ric Wright said:
>> >
>> >>Well, a little playing around didn't seem to help, but I am frankly not
>> >>an
>> >>expert on threads.  However, it seems to me that the source of the
>> >>problem
>> >>is that the vtkRenderWindowInteractor gets initialized then the start()
>> >>method creates an event loop that is monitored by the
>> >>vtkRenderWindowInteractor.  I suspect that start() method spawns a new
>> >>thread to listen to the events and it is the spawning of that thread
>> that
>> >>causes the exception.
>> >
>> >VTK's Cocoa classes never create any threads.
>> >
>> >Cheers,
>> >
>> >--
>> >____________________________________________________________
>> >Sean McBride, B. Eng                 sean at rogue-research.com
>> >Rogue Research                        www.rogue-research.com
>> >Mac Software Developer              Montréal, Québec, Canada
>> >
>> >
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130814/45ad9344/attachment.htm>


More information about the vtkusers mailing list