OpenVR camera viewup

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

OpenVR camera viewup

nzdexter
This post has NOT been accepted by the mailing list yet.
Hi,

I have got things to work for OpenVR, i.e. I can display a mesh in 3D following the basic example given at

https://blog.kitware.com/taking-paraview-into-virtual-reality/

The object that I am displaying is a 3D view of a geothermal reservoir. However when I display the reservoir it has the y-axis pointing up in the vertical. What I would like to do is change the viewup of the camera so that it points the z-axis up in the vertical. However I can't get this to work. Here's my code snippet:

vtkSmartPointer<vtkOpenVRRenderer> renderer = vtkSmartPointer<vtkOpenVRRenderer>::New();
vtkSmartPointer<vtkOpenVRRenderWindow> renderWindow = vtkSmartPointer<vtkOpenVRRenderWindow>::New();
vtkSmartPointer<vtkOpenVRRenderWindowInteractor> iren = vtkSmartPointer<vtkOpenVRRenderWindowInteractor>::New();
vtkSmartPointer<vtkOpenVRCamera> cam = vtkSmartPointer<vtkOpenVRCamera>::New();

renderWindow->AddRenderer(renderer.Get());
renderer->AddActor(MeshActor);

MATHLIB::VECTOR3 cp = getMeshCentre();  // external function, returns some x/y/z coordinates
cam->SetViewUp(0,0,1);
cam->SetFocalPoint(cp[0], cp[1], cp[2]);
cam->SetPosition(cp[0] + 1.0, cp[1], cp[2]);

iren->SetRenderWindow(renderWindow.Get());
renderer->SetActiveCamera(cam.Get());

renderer->ResetCamera();  // zoom out!
renderWindow->Render();
iren->Start();
Loading...