[vtkusers] VTK + OpenHaptics how can I attach OpenHaptics to the main loop
Harchet
padilla1957 at gmail.com
Mon Nov 28 06:34:08 EST 2011
Here is the whole code, the sphere of the cursor is not render, I do not
why...
// Construct a haptics cursor
vtkSmartPointer<vtkSphereSource> sphere =
vtkSmartPointer<vtkSphereSource>::New();
vtkSmartPointer<vtkPolyDataMapper> sphereMapper =
vtkSmartPointer<vtkPolyDataMapper>::New(); //mapper for the cursor
vtkSmartPointer<vtkOpenHapticsCursorActor> cursorActor =
vtkSmartPointer<vtkOpenHapticsCursorActor>::New(); //actor for the cursor
sphere->Update();
sphereMapper->SetInput(sphere->GetOutput());
cursorActor->SetMapper(sphereMapper);
//mapper to transform so can be rendered and touched
vtkCubeSource* cube = vtkCubeSource::New();
vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(cube->GetOutputPort());
//create a OpenHaptics Actor for the model
vtkSmartPointer<vtkOpenHapticsActor> actor =
vtkSmartPointer<vtkOpenHapticsActor>::New();
actor->SetMapper(mapper);
//create a OpenHaptics renderer
vtkSmartPointer<vtkOpenHapticsRenderer> renderer =
vtkSmartPointer<vtkOpenHapticsRenderer>::New();
renderer->AddActor(actor);
renderer->AddActor(cursorActor);
//visualize
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->SetWindowName("Nvision RR");
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow ( renderWindow );
//Add actors to the renderers
renderWindow->Render();
//Interact with the window
renderWindowInteractor->Start();
--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-OpenHaptics-how-can-I-attach-OpenHaptics-to-the-main-loop-tp5013641p5028587.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list