<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I try to abort a lengthy rendering before it finishs. <br>I first measured the time it takes to finish rendering everything. <br><br>start = time(NULL);<br>renWindow-&gt;Render();<br>end = time(NULL);<br>cout &lt;&lt;"time spent for rendering: " &lt;&lt;difftime(end, start)&lt;&lt;endl;<br><br>it was 19 seconds.<br><br>then I tried to kill the rendering process before it finish by doing this: <br>Once render window showed up, I clicked it. renWindow-&gt;Render() came back,<br> and rendering took 3 seconds. <br><br>but after that, render window was still not responsive. Only after about <br>16 seconds, the complete images show up in window and window became <br>responsive after that. <br><br>It looks to me that although vtk already kill the rendering process, <br>Windows still try to finish rendering everything. That might explain why<br> the window remained not
 responsive until everything finished rendering.<br><br>Does anybody knows the true reason? and how could I kill the rendering <br>process and immediately get back the interaction with the window?<br><br>Thank you very much<br><br>Tracy<br><br>the code is as following:<br>======================================<br>#include "vtkRenderer.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkStructuredPointsReader.h"<br>#include "vtkPiecewiseFunction.h"<br>#include "vtkVolumeProperty.h"<br>#include "vtkVolumeRayCastCompositeFunction.h"<br>#include "vtkVolumeRayCastMapper.h"<br>#include "vtkVolume.h"<br>#include "vtkColorTransferFunction.h"<br>#include "vtkCamera.h"<br>#include "vtkStructuredPoints.h"<br>#include "vtkInteractorStyleTrackballCamera.h"<br>#include "vtkCommand.h"<br>#include "time.h"<br><br>class InteractionCallBack : public vtkCommand {<br><br>public:<br><br>&nbsp; static InteractionCallBack* New()
 {<br>&nbsp; &nbsp; return new InteractionCallBack;<br>&nbsp; }<br><br>&nbsp; virtual void Execute(vtkObject* caller, unsigned long, void* data) {<br>&nbsp; &nbsp; vtkRenderWindow* renWin = vtkRenderWindow::SafeDownCast(caller);<br>&nbsp; &nbsp; if (renWin-&gt;GetEventPending()) {<br>&nbsp; &nbsp; &nbsp; renWin-&gt;SetAbortRender(1);<br>&nbsp; &nbsp; }<br>&nbsp; }<br><br>};<br><br>int main( int argc, char *argv[] )<br>{<br>&nbsp;&nbsp;&nbsp; vtkStructuredPointsReader *reader = vtkStructuredPointsReader::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; reader-&gt;SetFileName("D:\\Simulations\\ironProt.vtk");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; reader-&gt;Update();<br><br>&nbsp;&nbsp;&nbsp; vtkPiecewiseFunction *opacity = vtkPiecewiseFunction::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; opacity-&gt;AddSegment(0, 0.0, 255, 0.5);<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; vtkVolumeProperty *volumeProperty =
 vtkVolumeProperty::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; volumeProperty-&gt;SetScalarOpacity(opacity);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; volumeProperty-&gt;SetInterpolationTypeToLinear();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; volumeProperty-&gt;ShadeOn();<br><br>&nbsp;&nbsp;&nbsp; vtkVolumeRayCastCompositeFunction *compositeFunction = vtkVolumeRayCastCompositeFunction::New();<br>&nbsp;&nbsp;&nbsp; vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; volumeMapper-&gt;SetInput(reader-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; volumeMapper-&gt;SetVolumeRayCastFunction(compositeFunction);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; volumeMapper-&gt;SetSampleDistance(0.01);<br><br>&nbsp;&nbsp;&nbsp; vtkVolume *volume = vtkVolume::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; volume-&gt;SetMapper(volumeMapper);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 volume-&gt;SetProperty(volumeProperty);<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; vtkRenderer *renderer = vtkRenderer::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renderer-&gt;SetBackground(1.0, 1.0, 1.0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renderer-&gt;AddVolume(volume);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renderer-&gt;ResetCamera();<br>&nbsp;&nbsp;&nbsp; vtkRenderWindow *renWindow = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renWindow-&gt;SetSize(400,400);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renWindow-&gt;SetPosition(600, 400);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renWindow-&gt;AddRenderer(renderer);<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; interactor-&gt;SetRenderWindow(renWindow);<br>&nbsp;&nbsp;&nbsp; vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();<br>&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; interactor-&gt;SetInteractorStyle(style);<br><br>&nbsp;&nbsp;&nbsp; InteractionCallBack* icb = InteractionCallBack::New();<br>&nbsp;&nbsp;&nbsp; renWindow-&gt;AddObserver(vtkCommand::AbortCheckEvent, icb);<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; time_t start, end;<br>&nbsp;&nbsp;&nbsp; start = time(NULL);<br><br>&nbsp;&nbsp;&nbsp; renWindow-&gt;Render();<br><br>&nbsp;&nbsp;&nbsp; end = time(NULL);<br>&nbsp;&nbsp;&nbsp; cout &lt;&lt;"time spent for rendering: " &lt;&lt;difftime(end, start)&lt;&lt;endl;<br><br>&nbsp;&nbsp;&nbsp; interactor-&gt;Start();<br><br>&nbsp;&nbsp;&nbsp; renderer-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; renWindow-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; interactor-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; reader-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; opacity-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; volumeProperty-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; compositeFunction-&gt;Delete();<br>&nbsp;&nbsp;&nbsp;
 volumeMapper-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; volume-&gt;Delete();<br><br>&nbsp;&nbsp;&nbsp; return 0;<br><br>}<br><br></td></tr></table><br>