<div dir="auto">Aha, thank you both for the clarification/tip.<div dir="auto"><br></div><div dir="auto">I had hoped that there was a way in VTK to request a re-render to occur once control returns to the Qt event loop, instead of the immediate Render().<div dir="auto"><br></div><div dir="auto">That way an application could afford to be "sloppy" and request a re-render multiple times during the processing of a single event, but it would in the end only result in a single re-render.</div><div dir="auto"><br></div><div dir="auto">The ITK help class I guess could help here, but I'm always weary of bringing in additional dependencies. Thanks for the tip though, we may end up using it.</div><div dir="auto"><br></div><div dir="auto">My endeavour was not to solve any identified problems in our app. I just wrongly though that calling Render was discouraged in favor of update(), so was wondering why it didn't work.</div><div dir="auto"><br></div><div dir="auto">I may go with the do nothing approach now that I know that Render is not bad per se.</div><div dir="auto"><br></div><div dir="auto">Elvis</div></div></div><br><div class="gmail_quote"><div dir="ltr">Den tis 19 juni 2018 17:32Andras Lasso <<a href="mailto:lasso@queensu.ca">lasso@queensu.ca</a>> skrev:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You can use CTK's ctkVTKAbstractView class to handle this. It has scheduleRender method, which you call any time something might have changed in your pipeline. Actual rendering will not happen more frequently than the specified maximumUpdateRate.<br>
<br>
<a href="https://github.com/commontk/CTK/blob/master/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.h#L77" rel="noreferrer noreferrer" target="_blank">https://github.com/commontk/CTK/blob/master/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.h#L77</a> <br>
<br>
Andras<br>
<br>
-----Original Message-----<br>
From: vtkusers <<a href="mailto:vtkusers-bounces@public.kitware.com" target="_blank" rel="noreferrer">vtkusers-bounces@public.kitware.com</a>> On Behalf Of Utkarsh Ayachit<br>
Sent: Tuesday, June 19, 2018 10:38 AM<br>
To: Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com" target="_blank" rel="noreferrer">elvis.stansvik@orexplore.com</a>><br>
Cc: vtk <<a href="mailto:vtkusers@vtk.org" target="_blank" rel="noreferrer">vtkusers@vtk.org</a>><br>
Subject: Re: [vtkusers] QVTKOpenGLWidget - update() or GetRenderWindow()->Render()<br>
<br>
Elvis,<br>
<br>
The best practice is indeed to call Render() when data has changed.<br>
While making QVTKOpenGLWidget (which is called QVTKOpenGLSimpleWidget in master) do a `RenderWindow::Render` in paint may seem like a good behavior (as we indeed did initially), it so happens that the paint gets called way too frequently e.g. if a tooltip or a menu pops  up.<br>
Doing these potentially expensive renders in each `paint` is not necessary since QVTKOpenGLWidget caches the last rendered image and can simply `blit` it to the active frame buffer to satisfy Qt. Hence we opted to let the application decide when scene has truly changed and call Render explicitly to indicate that.<br>
<br>
Hope that clarifies things.<br>
<br>
Utkarsh<br>
On Tue, Jun 19, 2018 at 10:20 AM Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com" target="_blank" rel="noreferrer">elvis.stansvik@orexplore.com</a>> wrote:<br>
><br>
> Hi all,<br>
><br>
> I was looking over calls to Render() in our application, trying to replace them with update() which I think is a "nicer" way of requesting a re-render (?).<br>
><br>
> But it seems to not be a drop-in replacements since it seems sometimes update() doesn't cause a re-render (not even when control returns to the event loop).<br>
><br>
> So then I looked again at the docs for QVTKOpenGLWidget, and they say:<br>
><br>
>     "An alternative is to call update() on the widget instance to trigger a render once the context gets validated"<br>
><br>
> It was this that sort of guided me to try to use update() instead of Render().<br>
><br>
> But then I found e.g. this commit:<br>
><br>
>     "<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.kitware.com%2Fvtk%2Fvtk%2Fcommit%2F4c77c46025e737ad66e0b797a759e73d81c9f240&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=8m7aw0XcHhoXg5h%2BH%2FnywEEfXlSKd04Fc3%2F2wKRcaRc%3D&reserved=0" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.kitware.com%2Fvtk%2Fvtk%2Fcommit%2F4c77c46025e737ad66e0b797a759e73d81c9f240&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=8m7aw0XcHhoXg5h%2BH%2FnywEEfXlSKd04Fc3%2F2wKRcaRc%3D&reserved=0</a>"<br>
><br>
> The commit message says: "QVTKOpenGLWidget now relies on VTK applications calling `Render` on the window when data or rendering has changed.".<br>
><br>
> So now I'm a little confused: What is the correct way to request a re-render once control returns to the event loop? Or must we always call Render()?<br>
><br>
> I'm talking now about the QVTKOpenGLWidget that is in 8.1.1, not the new one that is in master (though I guess the best practice should be the same for the two?).<br>
><br>
> Many thanks in advance,<br>
> Elvis<br>
> _______________________________________________<br>
> Powered by <br>
> <a href="https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&dat" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&dat</a><br>
> a=02%7C01%7Classo%<a href="http://40queensu.ca" rel="noreferrer noreferrer" target="_blank">40queensu.ca</a>%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd6<br>
> 1ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=NuXp<br>
> HHrNM9ouQUfibQdvb%2FvdHXbDdJt2gUMbKCwoQhU%3D&reserved=0<br>
><br>
> Visit other Kitware open-source projects at <br>
> <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ki" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ki</a><br>
> <a href="http://tware.com" rel="noreferrer noreferrer" target="_blank">tware.com</a>%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queens<br>
> <a href="http://u.ca" rel="noreferrer noreferrer" target="_blank">u.ca</a>%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b<br>
> 925c%7C1%7C0%7C636650159330792727&sdata=Xppm3uezu3nyaA9rf5IxxDqLMBeyBb<br>
> 6nIrt%2FForVoBs%3D&reserved=0<br>
><br>
> Please keep messages on-topic and check the VTK FAQ at: <br>
> <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vt" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vt</a><br>
> <a href="http://k.org" rel="noreferrer noreferrer" target="_blank">k.org</a>%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%<a href="http://40queensu.ca" rel="noreferrer noreferrer" target="_blank">40queensu.ca</a>%7C2c47a8aa57e<br>
> e44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636<br>
> 650159330792727&sdata=hhRnwdAr4eTN5Tidn%2FhjGoDj9REIazlvfVgW3V8uAPs%3D<br>
> &reserved=0<br>
><br>
> Search the list archives at: <br>
> <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkma" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkma</a><br>
> <a href="http://il.org" rel="noreferrer noreferrer" target="_blank">il.org</a>%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%<a href="http://40queensu.ca" rel="noreferrer noreferrer" target="_blank">40queensu.ca</a>%7C<br>
> 2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C<br>
> 1%7C0%7C636650159330792727&sdata=xChSvX1Q%2BjBODVNNLWtCkFaoEdhSR1KeRIi<br>
> MBCM%2Bm%2Bo%3D&reserved=0<br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpubli" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpubli</a><br>
> <a href="http://c.kitware.com" rel="noreferrer noreferrer" target="_blank">c.kitware.com</a>%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40q<br>
> <a href="http://ueensu.ca" rel="noreferrer noreferrer" target="_blank">ueensu.ca</a>%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb<br>
> 2838b925c%7C1%7C0%7C636650159330792727&sdata=vjwoMbm%2BOqCgp4O%2F7h%2F<br>
> JqtvqoSZWx%2FQwpot6Gqs%2BLiE%3D&reserved=0<br>
_______________________________________________<br>
Powered by <a href="https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=NuXpHHrNM9ouQUfibQdvb%2FvdHXbDdJt2gUMbKCwoQhU%3D&reserved=0" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=NuXpHHrNM9ouQUfibQdvb%2FvdHXbDdJt2gUMbKCwoQhU%3D&reserved=0</a><br>
<br>
Visit other Kitware open-source projects at <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=Xppm3uezu3nyaA9rf5IxxDqLMBeyBb6nIrt%2FForVoBs%3D&reserved=0" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=Xppm3uezu3nyaA9rf5IxxDqLMBeyBb6nIrt%2FForVoBs%3D&reserved=0</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=hhRnwdAr4eTN5Tidn%2FhjGoDj9REIazlvfVgW3V8uAPs%3D&reserved=0" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=hhRnwdAr4eTN5Tidn%2FhjGoDj9REIazlvfVgW3V8uAPs%3D&reserved=0</a><br>
<br>
Search the list archives at: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=xChSvX1Q%2BjBODVNNLWtCkFaoEdhSR1KeRIiMBCM%2Bm%2Bo%3D&reserved=0" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=xChSvX1Q%2BjBODVNNLWtCkFaoEdhSR1KeRIiMBCM%2Bm%2Bo%3D&reserved=0</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=vjwoMbm%2BOqCgp4O%2F7h%2FJqtvqoSZWx%2FQwpot6Gqs%2BLiE%3D&reserved=0" rel="noreferrer noreferrer" target="_blank">https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=vjwoMbm%2BOqCgp4O%2F7h%2FJqtvqoSZWx%2FQwpot6Gqs%2BLiE%3D&reserved=0</a><br>
</blockquote></div>