[vtkusers] GUI integration

egk865 at yahoo.com egk865 at yahoo.com
Sun Aug 8 23:53:48 EDT 2010


Hi Nicolas,

I probably wouldn't try modifying the renderer as you describe from
within c++, though I don't know enough about the inner workings of the
awt widgets to know for sure if it's the wrong approach or not. The
threading issue I was referring to is the fact that when using the awt
classes, you need to surround with lock() and unlock() any code which
causes a call the underlying windowing system, such as an XLib call on
linux. This includes calls to vtkRenderWindow::Render() or picking
operations and other functions as well. See for example the
implementation of the Render() function in vtkRenderWindowPanel.java
where some parts are surrounded by lock and unlock. Now if you wanted
to modify the renderer from within c++, you would need to avoid making
such calls, or I suppose though you could try calling native versions
of lock and unlock (see the file Common/vtkJavaAwt.h).

If you have existing C++ code which you need to continue using, I
would use vtk's wrapping facilities to wrap your own c++ classes in
java and instantiate your custom classes from within java. E.g. create your
own filter in c++ which calls your other c++ code, wrap that in java,
and add your custom filter to a pipeline in java.



Eli


--- On Thu, 8/5/10, nclemeur <nclemeur at gmail.com> wrote:

> From: nclemeur <nclemeur at gmail.com>
> Subject: Re: [vtkusers] GUI integration
> To: vtkusers at vtk.org
> Date: Thursday, August 5, 2010, 10:37 PM
> 
> 
> Bugzilla from egk865 at yahoo.com
> wrote:
> > 
> > I have noticed some flickering issues on Windows XP
> during resize though
> > I'm not sure of the cause. Linux and Mac seemed to be
> fine for me. See the
> > thread started here:
> > http://www.vtk.org/pipermail/vtkusers/2010-June/109872.html
> > 
> 
> It seems that it might be covered in the 
> http://www.vtk.org/Wiki/VTK/FAQ#How_can_I_stop_Java_Swing_or_AWT_components_from_flashing_or_bouncing_between_values.3F
> FAQ . I will try that tonight. Hopefully, this will
> help...
> 
> 
> Bugzilla from egk865 at yahoo.com
> wrote:
> > 
> > I've never tried displaying in Java from within C++ as
> you suggest, though
> > it might work since the Java wrappers are just a very
> thin layer on top of
> > C++. You would need to test. This is assuming you
> avoid the AWT classes.
> > If however, you want to use the AWT classes then it
> might be a lot more
> > difficult since I believe you need to deal with other
> things like
> > threading issues. You would probably want to learn
> more about the AWT
> > Native Interface.
> > 
> 
> Well, my intention was to use the available class (for
> example
> vtkRenderWindowPanel) and send to my C++ layer a reference
> to the renderer
> and cast to to a native vtkRenderer and then work on it in
> C++ (I am quite
> new to vtk so this might be completely wrong). When done
> with it I would
> request a repaint from java, so that the screen get's
> updated...  Does that
> make sense or am I going in the wrong direction? Would that
> prevent the
> threading issue your are mentionning?  I am quite
> close to get an
> environment where I can start testing this, so hopefully I
> can answer some
> question my-self, but please let me know if you believe
> this is really a
> wrong approach.
> 
> Thank you again
> 
> Nicolas
> 
> 
> 
> 
> 
> -- 
> View this message in context: http://vtk.1045678.n5.nabble.com/GUI-integration-tp2260958p2266232.html
> Sent from the VTK - Users mailing list archive at
> Nabble.com.
> _______________________________________________
> Powered by 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
>







      



More information about the vtkusers mailing list