[vtk-developers] vtkfollower performance problem

eclipse irocks0922 at gmail.com
Tue Dec 5 21:08:59 EST 2017


Sorry for cross posting.

I uploaded same post StackOverflow, vtk user mailing lis, vtk git issues
but nobody made an answer for this.

please forgive me.


I am trying to add vtkfollower to vtkrenderer for indicating the chosen
point.

textured vtkfollower is represented correctly, but in the renderer, if I
look closer (camera comes closer to polydata) it's getting really
slow(frame drop) and the boundary of image turned into black. I did not set
the edge line or something might be related.

then, if I move camera far from model its rendering performance is going
back to normal.

here is the code.

why is this situation happening? Did I something in a wrong way?

`m_SourceFromQrc = vtkSmartPointer::New();

        m_SourceFromQrc->SetQImage(&m_qimageFromQrc);
m_SourceFromQrc->Update();        m_spVTKTexture =
vtkSmartPointer<vtkTexture>::New();
m_spVTKTexture->SetInputConnection(m_SourceFromQrc->GetOutputPort());
      m_spVTKTexture->Update();        m_spVTKPlane =
vtkSmartPointer<vtkPlaneSource>::New();
m_spVTKPlane->SetNormal(0.0, 0.0, 1.0);
m_spVTKTextureMappedPlane =
vtkSmartPointer<vtkTextureMapToPlane>::New();
m_spVTKTextureMappedPlane->SetInputConnection(m_spVTKPlane->GetOutputPort());
       m_planeDataMapper =
vtkSmartPointer<vtkOpenGLPolyDataMapper>::New();
m_planeDataMapper->SetInputConnection(m_spVTKTextureMappedPlane->GetOutputPort());
       double followerOriginPoint[3] = { 0.0 };
followerOriginPoint[1] = -1 / 2.0;        m_follower =
vtkSmartPointer< vtkFollower>::New();
m_follower->SetOrigin(followerOriginPoint);
m_follower->SetPosition(            pos[0] - followerOriginPoint[0],
         pos[1] - followerOriginPoint[1],            pos[2] -
followerOriginPoint[2]);        m_follower->SetScale(6);
m_follower->SetMapper(m_planeDataMapper);
m_follower->SetTexture(m_spVTKTexture);
m_follower->SetCamera(getRenderer(m_rendererType)->GetActiveCamera());
       m_follower->VisibilityOn();
m_follower->ForceOpaqueOff();
getRenderer(m_rendererType)->AddActor(m_follower);`

If I change this code m_follower->SetTexture(m_spVTKTexture);

into m_follower->GetProperty()->SetTexture(m_spVTKTexture);,

Then, follower rendered properly without performance loss. but
ForceOpaqueOff()does not work.

I am using VTK 7.0.

And the renderer is vtkrenderer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20171206/ded6416c/attachment.html>


More information about the vtk-developers mailing list