[vtkusers] vtkPolyData Modified() and rendering

Cory Quammen cory.quammen at kitware.com
Mon Mar 14 09:31:45 EDT 2016


David,

Have you tried removing the polydata->Modified() call when you
explicitly call renderWindow->Render()? If so, I suspect you won't see
any changes in the render window.

The polydata->Modified() call will tell the mapper that the content of
the poly data has changed. Direct changes to the point and cell data
structures do not trigger the Modified() call on the poly data
automatically. vtkPolyData could be made to do that by observing its
point and cell data objects, but it does not, so you must do it
manually.

I hope that clears things up for you,
Cory

On Mon, Mar 14, 2016 at 5:50 AM, MOUSSAUD David 244079
<David.MOUSSAUD at cea.fr> wrote:
> Hello,
>
>
>
> Could someone explain me how to use smartly the Modified() method for
> vtkPolyData.
>
> In attachment, I give a simple example. I’m with VTK 6.3 and I use Qt
> bindings.
>
>
>
> I have a timer (200ms) that fill dynamically a vtkPolyData instance.
>
>
>
> points->Initialize();
>
> vertices->Initialize();
>
> colors->Initialize();
>
>
>
> for(quint8 i=0;i<nb_points;i++)
>
> {
>
> points->InsertNextPoint(i*0.01, 0.0, 0.0);
>
> vertex->GetPointIds()->SetId(0,i);
>
> vertices->InsertNextCell(vertex);
>
> /* the first point is red, others are blue */
>
> if(i==0)
>
> colors->InsertNextTuple3(255,0,0);
>
> else
>
> colors->InsertNextTuple3(0,0,255);
>
> }
>
>
>
> And just after I call : polydata->Modified();
>
>
>
> This call produces no effects unless if I click inside my renderWindow or
> resize it.
>
>
>
> If a add an other timer (100ms) that just call renderWindow->Render(); ,
> then my points are well updated in my renderWindow but the Modified() call
> seems useless.
>
>
>
> Thanks in advance for your support,
>
> Regards,
>
>
>
> David
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.


More information about the vtkusers mailing list