[vtkusers] Why does a change to underlying poly-data not effect the graphical representation ? (ignore previous messge !)

David Gobbi david.gobbi at gmail.com
Fri Jul 25 07:43:35 EDT 2008


Hi Oliver,

You have to call Modified() on the mapper, and it is a good idea to
call Modified() on the polydata, too.

    m_polydata->Modified();
    m_mapper->Modified();
    m_polydata->Update();
    m_mapper->Update();

Calling modified just on the polydata is not enough, because VTK uses
the modified times for its pipeline, rather than the data itself, to
decide when to re-execute.

    David


On Fri, Jul 25, 2008 at 7:31 AM, Oliver Kania
<ptw.freiburg at googlemail.com> wrote:
> Hello !
> Sorry for posting one more time, please ignore the previous message:
>
> I have a VTK question that has cost me time
> and a lot of hair ;)
>
> I am defining poly data, a mapper and an actor.
> Now, when I change the underlying poly-Data, the graphical representation
> does not change :
>
> ----------------------------------------------------------------------
>
> vtkPoints* l_pts = vtkPoints::New();
>
>     l_pts->InsertPoint(0,0.0,0.0,-1.0);
>     l_pts->InsertPoint(1,0.0,0.0,-1.0);
>     l_pts->InsertPoint(2,0.0,0.0,-1.0);
>     l_pts->InsertPoint(3,0.0,0.0,-1.0);
>
>     vtkCellArray* l_cells = vtkCellArray::New();
>
>     l_cells->InsertNextCell(4);
>     l_cells->InsertCellPoint(0);
>     l_cells->InsertCellPoint(1);
>     l_cells->InsertCellPoint(2);
>     l_cells->InsertCellPoint(3);
>
>     m_polydata->SetPoints(l_pts);
>     m_polydata->SetPolys(l_cells);
>
>     CDataSpace* l_space       = l_prop->GetBox().get();
>     m_polydata->GetPoints()->SetPoint(0,l_space->x_min,l_space->y_min,-1.0);
>     m_polydata->GetPoints()->SetPoint(1,l_space->x_min,l_space->y_max,-1.0);
>     m_polydata->GetPoints()->SetPoint(2,l_space->x_max,l_space->y_max,-1.0);
>     m_polydata->GetPoints()->SetPoint(3,l_space->x_max,l_space->y_min,-1.0);
>
>
>     m_polydata->Update();
>     m_mapper->Update();
>
> ----------------------------------------------------------------------
>
> The first time I am doing this works, but when i change the points using
> getPoint()->setPoint(....)  again, nothing happens.
>
> regards, Oliver
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list