[Paraview] Is vtkSMMultiViewRenderModuleProxy deprecated?
Alexis Chan
alexisc at stanfordalumni.org
Tue Mar 1 11:15:12 EST 2011
Hi
I'm trying to build 2 independent views with the option of independent
filtering *and *joined filtering of the same data/object. I want 2 users to
use ParaView with independent head-tracking, allow them to independently
apply filters to the same dataset, have the option of sharing the filters
between them and sharing the views.
In my test code attached below, the trackers are not able to control the
viewpoint of either windows.
The actual plugin code with 1 tracker and 1 view works:
https://github.com/alexisylchan/ParaView/blob/master/Plugins/VRPN/pqVRPNStarter.cxx
*Test code:*
// Normal geometry creation
vtkConeSource* cone = vtkConeSource::New();
vtkPolyDataMapper * coneMapper = vtkPolyDataMapper::New();
coneMapper->SetInputConnection(cone->GetOutputPort());
vtkActor* coneActor = vtkActor::New();
coneActor->SetMapper(coneMapper);
coneActor->SetPosition(10,0,0);
vtkPolyDataReader* reader = vtkPolyDataReader::New();
reader->SetFileName("D:/alexisc/good-spindle.vtk");
vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
mapper->SetInputConnection(reader->GetOutputPort());
vtkActor* actor = vtkActor::New();
actor->SetMapper(mapper);
actor->SetScale(0.01, 0.01, 0.01);
vtkAxesActor* axesActor = vtkAxesActor::New();
vtkRenderer* renderer = vtkRenderer::New();
renderer->AddViewProp(actor);
renderer->AddViewProp(axesActor);
renderer->AddViewProp(coneActor);
vtkRenderWindow* window = vtkRenderWindow::New();
window->SetSize(1000,1000);
window->AddRenderer(renderer);
//Add second window
vtkRenderWindow* window2 = vtkRenderWindow::New();
window2->SetSize(1000,1000);
window2->AddRenderer(renderer);
/////////////////////////FIRST TRACKER////////////////////////////
//Create connection to VRPN Tracker using vtkInteractionDevice.lib
vtkVRPNTracker* tracker = vtkVRPNTracker::New();
tracker->SetDeviceName("Tracker0 at tracker1-cs:3883");
//My custom Tracker placement
tracker->SetTracker2WorldTranslation(-7.47, 0, -1.5);
// Rotate 90 around x so that tracker is pointing upwards instead of
towards view direction.
double t2w[3][3] = { 1, 0, 0,
0, 0, -1,
0, 1, 0 };
double t2wQuat[4];
vtkMath::Matrix3x3ToQuaternion(t2w, t2wQuat);
tracker->SetTracker2WorldRotation(t2wQuat);
tracker->Initialize();
//Create device interactor style (defined in vtkInteractionDevice.lib)
that determines how the device manipulates camera viewpoint
vtkVRPNTrackerStyleCamera* trackerStyleCamera =
vtkVRPNTrackerStyleCamera::New();
trackerStyleCamera->SetTracker(tracker);
trackerStyleCamera->SetRenderer(renderer);
/////////////////////////SECOND TRACKER////////////////////////////
//Create connection to VRPN Tracker using vtkInteractionDevice.lib
vtkVRPNTracker* tracker2 = vtkVRPNTracker::New();
tracker2->SetDeviceName("Tracker1 at tracker1-cs:3883");
//My custom Tracker placement
tracker2->SetTracker2WorldTranslation(-7.0, 0, -1.5);
// Rotate 90 around x so that tracker is pointing upwards instead of
towards view direction.
double t2w2[3][3] = { 1, 0, 0,
0, 0, -1,
0, 1, 0 };
double t2wQuat2[4];
vtkMath::Matrix3x3ToQuaternion(t2w2, t2wQuat2);
tracker2->SetTracker2WorldRotation(t2wQuat2);
tracker2->Initialize();
//Create device interactor style (defined in vtkInteractionDevice.lib)
that determines how the device manipulates camera viewpoint
vtkVRPNTrackerStyleCamera* trackerStyleCamera2 =
vtkVRPNTrackerStyleCamera::New();
trackerStyleCamera2->SetTracker(tracker2);
trackerStyleCamera2->SetRenderer(renderer);
//////////////////////////////////////////////////////////////////////////////
vtkDeviceInteractor* inputInteractor = vtkDeviceInteractor::New();
//Add first tracker to Device Interactor
inputInteractor->AddInteractionDevice(tracker);
inputInteractor->AddDeviceInteractorStyle(trackerStyleCamera);
vtkDeviceInteractor* inputInteractor2 = vtkDeviceInteractor::New();
//Add second tracker to second Device Interactor
inputInteractor2->AddInteractionDevice(tracker2);
inputInteractor2->AddDeviceInteractorStyle(trackerStyleCamera2);
vtkInteractionDeviceManager* idManager =
vtkInteractionDeviceManager::New();
//Get vtkRenderWindowInteractor from the Interaction Device Manager
(defined in vtkInteractionDevice.lib)
vtkRenderWindowInteractor* interactor =
idManager->GetInteractor(inputInteractor);
//Get second interactor
vtkRenderWindowInteractor* interactor2 =
idManager->GetInteractor(inputInteractor2);
//Set the vtkRenderWindowInteractor's style (trackballcamera) and window
vtkInteractorStyleTrackballCamera* interactorStyle =
vtkInteractorStyleTrackballCamera::New();
interactor->SetRenderWindow(window);
interactor->SetInteractorStyle(interactorStyle);
//Get second interactorStyle
vtkInteractorStyleTrackballCamera* interactorStyle2 =
vtkInteractorStyleTrackballCamera::New();
interactor2->SetRenderWindow(window2);
interactor2->SetInteractorStyle(interactorStyle2);
interactor->Initialize();
interactor2->Initialize();
// Clean up
// cone->Delete();
reader->Delete();
mapper->Delete();
actor->Delete();
renderer->Delete();
window->Delete();
tracker->Delete();
trackerStyleCamera->Delete();
inputInteractor->Delete();
idManager->Delete();
interactorStyle->Delete();
window2->Delete();
tracker2->Delete();
trackerStyleCamera2->Delete();
inputInteractor2->Delete();
interactorStyle2->Delete();
// Start interacting
interactor->Start();
interactor2->Start();
On Mon, Feb 28, 2011 at 10:49 AM, Utkarsh Ayachit <
utkarsh.ayachit at kitware.com> wrote:
> What exactly are you trying to do? vtkSMMultiViewRenderModuleProxy is
> deprecated, but it was never meant to be used directly anyways -- one
> simply created a view proxy and used it. Which is still true. Simply
> create multiple "RenderView" proxies and set "ViewPosition" and
> "ViewSize" properties on them to set up the layout.
>
> Utkarsh
>
>
> On Sun, Feb 27, 2011 at 4:44 PM, Alexis Chan <alexisc at stanfordalumni.org>
> wrote:
> > Hi
> >
> > I am interested in implementing multiple views (multiple interactors and
> > multiple renderers). I think this is a pretty good example for me to
> follow:
> > http://www.paraview.org/Wiki/Multiple_views
> >
> > But I cannot find vtkSMMultiViewRenderModuleProxy in my clone of the
> > ParaView git repository.
> >
> > Has the class been deprecated?
> >
> >
> > --
> > Alexis YL Chan
> >
> > _______________________________________________
> > 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 ParaView Wiki at:
> > http://paraview.org/Wiki/ParaView
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.paraview.org/mailman/listinfo/paraview
> >
> >
>
--
Alexis YL Chan <http://alexisylchan.wordpress.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110301/551d76ba/attachment-0001.htm>
More information about the ParaView
mailing list