<div dir="ltr">Hi all:<div>I have hundreds of images to display by using vtkResliceImageViewer. I need to draw a marker when the left mouse button is clicked. My current solution is to use vtkRegularPolygonSource to draw a circle. The problem is that the circle does not render immediately even if I called render() afterwards. However, if I scroll the mouse wheel, the circle will be rendered correctly. </div><div>The code snippet is attached below:</div><div><br></div><div>void add_marker()</div><div>{</div><div><div> auto _circle_source = vtkSmartPointer<vtkRegularPolygonSource>::New();</div><div><span style="white-space:pre"> </span>_circle_source->SetNormal(1, 0, 0);</div><div><span style="white-space:pre"> </span>_circle_source->SetRadius(1);</div><div><span style="white-space:pre"> </span>_circle_source->SetGeneratePolygon(false);</div><div><span style="white-space:pre"> </span>_circle_source->SetNumberOfSides(50);</div><div><span style="white-space:pre"> </span>_circle_source->Update();</div><div><span style="white-space:pre"> </span>auto _mapper = vtkSmartPointer<vtkPolyDataMapper>::New();</div><div><span style="white-space:pre"> </span>_mapper->SetInputData(_circle_source->GetOutput());</div><div><span style="white-space:pre"> </span>auto _actor = vtkSmartPointer<vtkActor>::New();</div><div><span style="white-space:pre"> </span>_actor->SetMapper(_mapper);</div><div><span style="white-space:pre"> </span>auto _cam_pos_x = _in->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera()->GetPosition()[0];</div><div><span style="white-space:pre"> </span>_actor->SetPosition(_cam_pos_x - 10, nipple[0], nipple[1]);</div><div><br></div><div><br></div><div><span style="white-space:pre"> </span>_actor->GetProperty()->SetColor(1.0, 1.0, 0.0);</div><div><span style="white-space:pre"> </span>_in->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(_actor);</div></div><div>}</div><div><br></div><div>The add_marker function was called in the callback of vtkCommand::LeftButtonPressEvent.</div><div>Anyone could help me to solve this problem?</div><div>Thank you.<br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Best regards,<br>Hugh Lo</div></div></div>
</div></div>