lundi 28 mai 2018

VTK5.10, QT4: Refresh Renderer on updated points

I've tried so much, but I don't get this work.

I want to build up an QT4 Application with an QVTK Widget. Sadly I need to use QT4 and therefore VTK 5.10.

There is an vtkActor that is dealing with some vtkPoints that should be rendered (nothing fancy, more or less from the Examples from VTK). Here is the pipeline initialization:

m_pdata = vtkSmartPointer<vtkPolyData>::New();

m_pdata->SetPoints(m_points);

m_vfilter = vtkSmartPointer<vtkVertexGlyphFilter>::New();
m_vfilter->SetInputConnection(m_pdata->GetProducerPort());
m_vfilter->Update();

m_vdata = vtkSmartPointer<vtkPolyData>::New();

m_vdata->ShallowCopy(m_vfilter->GetOutput());

m_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();

m_mapper->SetInputConnection(m_vdata->GetProducerPort());

m_pactor = vtkSmartPointer<vtkActor>::New();
m_pactor->SetMapper(m_mapper);
m_pactor->GetProperty()->SetPointSize(2);

m_renderer->AddActor(m_pactor);

After this the App calls m_rwindow->Render() to render the scene ...

Then I have an QT QLineEdit to add a Point to the vtkPoints, like this:

m_points->InsertNextPoint(point[0], point[1], point[2]);

And I want to refresh the view, so that the new point will be rendered too. But this will not happen ...

I tried to Update the pipeline like this (more or less in every constellation):

m_pdata->Modified();
m_pdata->Update();
m_vfilter->Modified();
m_vfilter->Update();
m_vdata->Modified();
m_vdata->Update();
m_mapper->Modified();
m_mapper->Update();
m_pactor->Modified();

But everything I get updated will be the old points (for example the color, or size of points ...).

Is it possible to rerender the points so the new Points are displayed too?

Aucun commentaire:

Enregistrer un commentaire