Whenever rendering with OpenVR, the scene is rotated. This is clearly visible with an vtkAxesActor
. The Z axis is parallel to the floor… this is not expected.
import vtk
from vtkmodules.vtkRenderingOpenVR import (
vtkOpenVRCamera,
vtkOpenVRRenderer,
vtkOpenVRRenderWindow,
vtkOpenVRRenderWindowInteractor,
)
renderer = vtk.vtkOpenVRRenderer()
renderWindow =vtk.vtkOpenVRRenderWindow()
iren = vtk.vtkOpenVRRenderWindowInteractor()
cam = vtk.vtkOpenVRCamera()
renderer.SetShowFloor(True)
renderer.SetBackground(0.2, 0.3, 0.4);
renderWindow.AddRenderer(renderer);
iren.SetRenderWindow(renderWindow);
renderer.SetActiveCamera(cam);
light = vtk.vtkLight()
light.SetLightTypeToSceneLight();
light.SetPosition(1.0, 1.0, 1.0);
renderer.AddLight(light);
#crazy frame rate requirement
#need to look into that at some point
renderWindow.SetDesiredUpdateRate(350.0);
iren.SetDesiredUpdateRate(350.0);
iren.SetStillUpdateRate(350.0);
renderer.RemoveCuller(renderer.GetCullers().GetLastItem());
axes = vtk.vtkAxesActor()
renderer.AddActor(axes)
# the HMD may not be turned on/etc
renderWindow.Initialize();
# if renderWindow.GetHMD():
renderer.ResetCamera();
renderWindow.Render();
iren.Start()