[vtkusers] map vtkViewport to a JComponent?
Steve M. Robbins
steven.robbins at videotron.ca
Wed Sep 21 22:00:58 EDT 2005
The java wrapping of vtk requires use of a heavyweight Canvas subclass
if one wants to use AWT or Swing.
The list archives show a number of queries about using lightweight
components. A typical answer is "sure, if you are willing to give up
on hardware acceleration and render into an offscreen buffer". For
example:
http://public.kitware.com/pipermail/vtkusers/2002-March/059773.html
I've had a quick look through the sources for vtkRenderWindow and
vtkViewport and a different solution presents itself.
As I understand things, a vtkRenderWindow must be a top-level window
and a vtkViewport is just a piece of the vtkRenderWindow. Is there
any reason we couldn't use a JFrame for the vtkRenderWindow, add some
lightweight JPanels to it, and use the bounds for the JPanel to set up
the region for the vtkViewport? With appropriate listeners, I imagine
you could keep the vtkViewport up-to-date with the location and size
of the JPanel. The upshot is that the lightweight JPanel basically
provides the screen region into which VTK renders.
I haven't tried this. Is there reason to think it will/won't work?
Has anyone already tried this?
-Steve
More information about the vtkusers
mailing list