[vtkusers] How to update the renderer when the data is modified?
Ali -
saveez at hotmail.com
Thu Nov 2 17:23:42 EST 2006
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
More information about the vtkusers
mailing list