Hello everyone~~<br>I want draw a recrangle dynamically with vtk ,<br>here is my way:<br>1,ceate a VtkPolydata and use it diaplay the rectangle<br>2,add the observer to the Interactor ,when the vtkCommand::LeftButtonPressEvent,LeftButtonReleaseEvent,MouseMoveEvent<br>happened call the command<br>3,in the execute() change the property of vtkpolydata and then render again<br>the main code is like below:<br><br>1&nbsp;&nbsp;&nbsp; points = vtkPoints::New();<br>&nbsp;&nbsp;&nbsp; points-&gt;SetNumberOfPoints(4);<br>&nbsp;&nbsp;&nbsp; points-&gt;SetPoint(0,90,90,0);<br>&nbsp;&nbsp;&nbsp; points-&gt;SetPoint(1,90,120,0);<br>&nbsp;&nbsp;&nbsp; points-&gt;SetPoint(2,120,120,0);<br>&nbsp;&nbsp;&nbsp; points-&gt;SetPoint(3,120,90,0);<br>&nbsp;&nbsp;&nbsp; lines = vtkCellArray::New();<br>&nbsp;&nbsp;&nbsp; lines-&gt;InsertNextCell(5); <br>&nbsp;&nbsp;&nbsp; lines-&gt;InsertCellPoint(0); <br>&nbsp;&nbsp;&nbsp; lines-&gt;InsertCellPoint(1); <br>&nbsp;&nbsp;&nbsp; lines-&gt;InsertCellPoint(2); <br>&nbsp;&nbsp;&nbsp; lines-&gt;InsertCellPoint(3); <br>&nbsp;&nbsp;&nbsp; lines-&gt;InsertCellPoint(0); <br>&nbsp;&nbsp;&nbsp; polyData = vtkPolyData::New();<br>&nbsp;&nbsp;&nbsp; polyData-&gt;SetPoints(points);<br>&nbsp;&nbsp;&nbsp; polyData-&gt;SetLines(lines);<br>&nbsp;&nbsp;&nbsp; vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();<br>&nbsp;&nbsp;&nbsp; mapper-&gt;SetInput(polyData);<br>&nbsp;&nbsp;&nbsp; vtkActor* rectActor = vtkActor::New();<br>&nbsp;&nbsp;&nbsp; rectActor-&gt;SetMapper(mapper);<br>&nbsp;&nbsp;&nbsp; rectActor-&gt;GetProperty()-&gt;SetColor( 1, 0, 0 ); <br>&nbsp;&nbsp;&nbsp; render-&gt;AddActor(rectActor);<br><br>2,&nbsp;&nbsp;&nbsp; MyInteractorCallback* m_pInteractorCallback = MyInteractorCallback::New();<br>&nbsp;&nbsp;&nbsp; iren-&gt;AddObserver( vtkCommand::LeftButtonPressEvent, m_pInteractorCallback);<br>&nbsp;&nbsp;&nbsp; iren-&gt;AddObserver( vtkCommand::LeftButtonReleaseEvent, m_pInteractorCallback);<br>&nbsp;&nbsp;&nbsp; iren-&gt;AddObserver( vtkCommand::MouseMoveEvent, m_pInteractorCallback);<br><br>3,&nbsp;&nbsp;&nbsp; virtual void Execute(vtkObject *caller, unsigned long eventId, void *callData)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (eventId==vtkCommand::LeftButtonPressEvent)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkWin32RenderWindowInteractor&nbsp; *interactor = reinterpret_cast&lt;vtkWin32RenderWindowInteractor *&gt;(caller);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double x = interactor-&gt;GetEventPosition()[0];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double y = interactor-&gt;GetEventPosition()[1];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MyLeftButtonDownEvent(x,y);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if(eventId==vtkCommand::LeftButtonReleaseEvent)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkWin32RenderWindowInteractor&nbsp; *interactor = reinterpret_cast&lt;vtkWin32RenderWindowInteractor *&gt;(caller);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double x = interactor-&gt;GetEventPosition()[0];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double y = interactor-&gt;GetEventPosition()[1];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MyLeftButtonUpEvent(x,y);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if(eventId ==vtkCommand::MouseMoveEvent)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkWin32RenderWindowInteractor&nbsp; *interactor = reinterpret_cast&lt;vtkWin32RenderWindowInteractor *&gt;(caller);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double x = interactor-&gt;GetEventPosition()[0];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double y = interactor-&gt;GetEventPosition()[1];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MyMouseMoveEvent(x,y);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; void MyLeftButtonDownEvent(double x,double y)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rectable = 1;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; x_lt = x;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; y_lt = y;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; points-&gt;SetPoint(0,x_lt,y_lt,0);<br><br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; void MyLeftButtonUpEvent(double x,double y)<br>&nbsp;&nbsp;&nbsp; {<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rectable =0;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; void MyMouseMoveEvent(double x,double y)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (1 == rectable)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; x_rb = x;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; y_rb = y;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; points-&gt;SetPoint(1,x_lt,y_rb,0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; points-&gt;SetPoint(2,x_rb,y_rb,0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; points-&gt;SetPoint(3,x_rb,y_lt,0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renWin-&gt;Render();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>but the rectangle didn't changed as I wish,<br>I debug the code and&nbsp; find the point has been changed but the rectangle didn't changed.<br>can anyone solve this problem?&nbsp; thx ~~~<br>