<div dir="ltr">Strangely enough, If I called vtkRenderer::ResetCamera() after vtkRenderer::AddActor(), the polygon will be drawn correctly. It seems that just vtkRenderWindow::Render() does not work.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 19, 2018 at 1:12 AM, <a href="mailto:lorfalwit@gmail.com">lorfalwit@gmail.com</a> <span dir="ltr"><<a href="mailto:lorfalwit@gmail.com" target="_blank">lorfalwit@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Thanks Todd. I am using Qt 5.10 on Windows 10. I have tried to call update() function to refresh the window, but it doesn't work.</div><div><br></div><div> </div><div><div style="font-size:12px;padding:2px 0">---Original---</div><div style="font-size:12px;background:#f0f0f0;color:#212121;padding:8px!important;border-radius:4px;line-height:1.5"><div><b>From:</b> "Todd"<<a href="mailto:nztoddler@yahoo.com" target="_blank">nztoddler@yahoo.com</a>></div><div><b>Date:</b> Fri, May 18, 2018 20:22 PM</div><div><b>To:</b> "lor fal"<<a href="mailto:lorfalwit@gmail.com" target="_blank">lorfalwit@gmail.com</a>>;</div><div><b>Cc:</b> "vtkusers"<<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>>;</div><div><b>Subject:</b> Re: [vtkusers] Cannot render polygen data immediately</div></div><div><div class="h5"><br><div dir="auto"><div>Hi Hugh</div><div dir="auto"><br></div><div dir="auto">You haven't said what platform you're using. Try invalidating the window region/rectangle, using the platform's window API.<br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On 18 May 2018 10:02 p.m., lor fal <<a href="mailto:lorfalwit@gmail.com" target="_blank">lorfalwit@gmail.com</a>> wrote:<br type="attribution"><blockquote class="m_1695108904397712969quote" style="border-left:1px solid rgb(204,204,204);margin:0px 0px 0px 7.18516px;padding:14px 16px 14px 8.98145px;color:rgb(149,149,149);background-color:rgb(245,246,250)"><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<<wbr>vtkRegularPolygonSource>::New(<wbr>);</div><div> _circle_source->SetNormal(1, 0, 0);</div><div> _circle_source->SetRadius(1);</div><div> _circle_source-><wbr>SetGeneratePolygon(false);</div><div> _circle_source-><wbr>SetNumberOfSides(50);</div><div> _circle_source->Update();</div><div> auto _mapper = vtkSmartPointer<<wbr>vtkPolyDataMapper>::New();</div><div> _mapper->SetInputData(_circle_<wbr>source->GetOutput());</div><div> auto _actor = vtkSmartPointer<vtkActor>::<wbr>New();</div><div> _actor->SetMapper(_mapper);</div><div> auto _cam_pos_x = _in->GetRenderWindow()-><wbr>GetRenderers()-><wbr>GetFirstRenderer()-><wbr>GetActiveCamera()-><wbr>GetPosition()[0];</div><div> _actor->SetPosition(_cam_pos_x - 10, nipple[0], nipple[1]);</div><div><br></div><div><br></div><div> _actor->GetProperty()-><wbr>SetColor(1.0, 1.0, 0.0);</div><div> _in->GetRenderWindow()-><wbr>GetRenderers()-><wbr>GetFirstRenderer()->AddActor(_<wbr>actor);</div></div><div>}</div><div><br></div><div>The add_marker function was called in the callback of vtkCommand::<wbr>LeftButtonPressEvent.</div><div>Anyone could help me to solve this problem?</div><div>Thank you.<br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div>Best regards,<br>Hugh Lo</div></div></div>
</div></div>
</blockquote></div><br></div></div></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Best regards,<br>Hugh Lo</div></div></div>
</div>