[vtkusers] vtkPolyData Modified() and rendering

MOUSSAUD David 244079 David.MOUSSAUD at cea.fr
Tue Mar 15 04:26:39 EDT 2016


Hi,

I've tried but my render window is updated even if I do not call the modified() method.

My question was in fact : is there a kind of thread started by VTK that monitors the timestamps of the modified data and take the responsibility to update the view without the need to call the render() method(). (the goal is to separate the model and the view, classic :))

David.


-----Message d'origine-----
De : Cory Quammen [mailto:cory.quammen at kitware.com] 
Envoyé : lundi 14 mars 2016 14:32
À : MOUSSAUD David 244079 <David.MOUSSAUD at cea.fr>
Cc : vtkusers at vtk.org
Objet : Re: [vtkusers] vtkPolyData Modified() and rendering

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