[vtkusers] How to update the renderer when the data is modified?
Glen Lehmann
glehmann at atamai.com
Thu Nov 2 17:30:36 EST 2006
Hi Ali,
Yes, in 10 years VTK has done a great job of figuring this one out.
Do some browsing through the Wiki or grab one of the VTK books to
learn a bit more about the VTK pipeline.
In short, VTK is demand-driven. You need to call Update() on your
vtkImageData after it is modified, this will update the pipeline.
HTH,
Glen
On 02/11/06, Ali - <saveez at hotmail.com> wrote:
> Hi,
>
> First of all, I think this should have been already implemented in VTK, the
> library is 10 years old! When some data is modified in the pipeline, the
> renderer does not get updated automatically.
>
> Trying the following ends up with the error: wglMakeCurrent failed in
> MakeCurrent(). What would the right way of implementing this? All I am doing
> is displaying an image with vtkImageViewer2, and all I want is the renderer
> to get updated automatically when the image data is modified.
>
> static void UpdateRenderer(vtkObject *vtkNotUsed( caller ),
> unsigned long vtkNotUsed(eventId),
> void *obj, void *)
> {
> vtkImageViewer2* vw = reinterpret_cast<vtkImageViewer2*>(obj);
> vw->Render();
> }
>
> main()
> {
> vtkImageImport im = vtkImageImport::New();
> // ...
> vtkImageViewer2 *viewer = vtkImageViewer2::New();
> // ...
> vtkCallbackCommand *cbc = vtkCallbackCommand::New();
> cbc->SetCallback(UpdateRenderer);
> cbc->SetClientData((void *)viewer);
> im->AddObserver(vtkCommand::RenderEvent, cbc);
> cbc->Delete();
> // ...
> }
>
> _________________________________________________________________
> Windows Live™ Messenger has arrived. Click here to download it for free!
> http://imagine-msn.com/messenger/launch80/?locale=en-gb
>
> _______________________________________________
> 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