Hi there! I am working on volume rendering for MIP/MinIP, VR and VE for MRI. Now here I edited so many codes for renderer, renderwindow, actor and mapper, etc.
But I found that it’s quite weried that when I tried to interacte with the renderwindow, I implemented with transporting the situation of mouse(here is the plan 1):
void MyClass::RotateMove(float fx, float fy)
{
vtkCamera* camera = classRenderer->GetActiveCamera();
double center[2];
center[0] = classRenderWindow->GetSize()[0] / 2.0;
center[1] = classRenderWindow->GetSize()[1] / 2.0;
double dx = fx - center[0];
double dy = fy - center[1];
double angle = vtkMath::DegreesFromRadians(atan2(dy, dx));
vtkSmartPointer<vtkTransform> RotateTrans = vtkSmartPointer<vtkTransform>::New();
RotateTrans->PostMultiply();
RotateTrans->RotateWXYZ(angle, 0, 0, 1);
camera->ApplyTransform(RotateTrans);
classRenderWindow->Render();
}
But I found that I can use a class namedvtkRenderInteractor
and defined a subclass based on ‘vtkInteractorStyle’. That’s the plan 2.
Now when I run code with plan 1. I found the updating frequency is TOO SLOW, when I tried to rotate the view, the VR image started blinking, too.
I suspect that because I reset lots of parameters and update render window each time, can plan2 of ‘vtkRenderInteractor’ make rendering faster? Or it’s not about the way I rendered(like some bugs I didn’t get it)
Could you give me some advice? Thanks a lot!