[vtkusers] Please help : Cross-platform VTK rendering
Shastry, Anand C (Research)
anand.shastry at ge.com
Tue Dec 14 01:16:56 EST 2004
Hi,
I have a GUI built using RSI IDL. The VTK volume rendering algorithm is in the form of a dll. From the IDL GUI, the dll gets called, the data passed by means of pointers.
I'm using vtkRenderWindowInteractor to interact with the rendering. I encounter 3 problems :
1. Deletion of objects created in the dll. The VTK memory is required as long as the rendered window is active. I dont know how to free this memory (for the window, renderer, volume object, etc of a standard rendering pipeline) on closing the render window. Tried putting it in the destructor, but doesn't seem to work.
2. Mouse/keyboard control transfer. Once the render window is created, the interaction is taken over by VTK. None of the IDL GUI buttons work till the VTK window is closed.
I want to be able to change rendering parameters (opacity, etc) from the IDL GUI & refresh the render window to reflect these.
Right now, this is only possible by closing the VTK window & popping up a new rendering window (another dll call).
3. The IDL GUI display does not refresh, when I drag or move the VTK render window. May be related to above problem.
The rendering pipeline I follow within the exec loop used to create the dll is :
vtkRenderer *renderer = vtkRenderer::New();
vtkVolume* volume = vtkVolume::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
vtkVolumeRayCastMapper *volMapper = vtkVolumeRayCastMapper::New();
vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New();
vtkColorTransferFunction *colorTransferFunction = vtkColorTransferFunction::New();
vtkVolumeRayCastCompositeFunction *compFunc = vtkVolumeRayCastCompositeFunction::New();
opacityTransferFunction->AddPoint(...)
colorTransferFunction->AddRGBPoint(..)
//set volume properties
volumeProperty->SetColor(...)
volumeProperty->SetScalarOpacity(...)
volMapper->SetInput (pImageIn);
volMapper->SetVolumeRayCastFunction (compFunc);
renWin->AddRenderer(renderer);
iren->SetRenderWindow(renWin);
iren->Initialize();
renderer->AddVolume(volume);
volMapper->Update();
iren->Start();
iren->Render();
renWin->Delete();
iren->Delete(); //Cannot delete any other object, as it's required
Any help is greatly appreciated, as I'm stuck here.
-Anand
More information about the vtkusers
mailing list