[vtkusers] question about the vtkImagePlaneWidget demo in the vtk package
dean.inglis at camris.ca
dean.inglis at camris.ca
Mon Aug 28 09:32:34 EDT 2006
Hi,
in the code below there are two renderers in
one render window. The render window gets
an interactor that monitors mouse events etc.
The widget gets connected to the render window
and one of its renderers when it sets the
interactor (see last line):
vtkRenderer* ren1 = vtkRenderer::New();
vtkRenderer* ren2 = vtkRenderer::New();
vtkRenderWindow* renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren2);
renWin->AddRenderer(ren1);// If I block this, the
vtkImagePlaneWidget will be automatically added to the ren2.
vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtkCellPicker* picker = vtkCellPicker::New();
picker->SetTolerance(0.005);
vtkProperty* ipwProp = vtkProperty::New();
//assign default props to the ipw's texture plane actor
vtkImagePlaneWidget* planeWidgetX = vtkImagePlaneWidget::New();
planeWidgetX->SetInteractor( iren);
By default, the widget will be rendered in the last
renderer added, which is why if you comment out
renWin->AddRenderer(ren1);
the widget will be rendered in ren1. If you want
to enforce which renderer to render it in, use the widget's
SetCurrentRenderer and SetDefaultRenderer methods which
are inherited from vtkInteractorObserver.
Dean
More information about the vtkusers
mailing list