[vtkusers] QVTKOpenGLWidget - update() or GetRenderWindow()->Render()
Elvis Stansvik
elvis.stansvik at orexplore.com
Tue Jun 19 11:51:11 EDT 2018
Aha, thank you both for the clarification/tip.
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().
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.
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.
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.
I may go with the do nothing approach now that I know that Render is not
bad per se.
Elvis
Den tis 19 juni 2018 17:32Andras Lasso <lasso at queensu.ca> skrev:
> 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.
>
>
> https://github.com/commontk/CTK/blob/master/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.h#L77
>
> Andras
>
> -----Original Message-----
> From: vtkusers <vtkusers-bounces at public.kitware.com> On Behalf Of Utkarsh
> Ayachit
> Sent: Tuesday, June 19, 2018 10:38 AM
> To: Elvis Stansvik <elvis.stansvik at orexplore.com>
> Cc: vtk <vtkusers at vtk.org>
> Subject: Re: [vtkusers] QVTKOpenGLWidget - update() or
> GetRenderWindow()->Render()
>
> Elvis,
>
> The best practice is indeed to call Render() when data has changed.
> 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.
> 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.
>
> Hope that clarifies things.
>
> Utkarsh
> On Tue, Jun 19, 2018 at 10:20 AM Elvis Stansvik <
> elvis.stansvik at orexplore.com> wrote:
> >
> > Hi all,
> >
> > 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 (?).
> >
> > 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).
> >
> > So then I looked again at the docs for QVTKOpenGLWidget, and they say:
> >
> > "An alternative is to call update() on the widget instance to
> trigger a render once the context gets validated"
> >
> > It was this that sort of guided me to try to use update() instead of
> Render().
> >
> > But then I found e.g. this commit:
> >
> > "
> 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
> "
> >
> > The commit message says: "QVTKOpenGLWidget now relies on VTK
> applications calling `Render` on the window when data or rendering has
> changed.".
> >
> > 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()?
> >
> > 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?).
> >
> > Many thanks in advance,
> > Elvis
> > _______________________________________________
> > Powered by
> > https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&dat
> > a=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd6
> > 1ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636650159330792727&sdata=NuXp
> > HHrNM9ouQUfibQdvb%2FvdHXbDdJt2gUMbKCwoQhU%3D&reserved=0
> >
> > Visit other Kitware open-source projects at
> > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ki
> > tware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queens
> > u.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b
> > 925c%7C1%7C0%7C636650159330792727&sdata=Xppm3uezu3nyaA9rf5IxxDqLMBeyBb
> > 6nIrt%2FForVoBs%3D&reserved=0
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vt
> > k.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C2c47a8aa57e
> > e44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636
> > 650159330792727&sdata=hhRnwdAr4eTN5Tidn%2FhjGoDj9REIazlvfVgW3V8uAPs%3D
> > &reserved=0
> >
> > Search the list archives at:
> > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkma
> > il.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C
> > 2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb2838b925c%7C
> > 1%7C0%7C636650159330792727&sdata=xChSvX1Q%2BjBODVNNLWtCkFaoEdhSR1KeRIi
> > MBCM%2Bm%2Bo%3D&reserved=0
> >
> > Follow this link to subscribe/unsubscribe:
> > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpubli
> > c.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40q
> > ueensu.ca%7C2c47a8aa57ee44de212b08d5d5f25ffa%7Cd61ecb3b38b142d582c4efb
> > 2838b925c%7C1%7C0%7C636650159330792727&sdata=vjwoMbm%2BOqCgp4O%2F7h%2F
> > JqtvqoSZWx%2FQwpot6Gqs%2BLiE%3D&reserved=0
> _______________________________________________
> Powered by
> 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
>
> Visit other Kitware open-source projects at
> 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
>
> Please keep messages on-topic and check the VTK FAQ at:
> 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
>
> Search the list archives at:
> 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
>
> Follow this link to subscribe/unsubscribe:
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180619/5cf5ae57/attachment.html>
More information about the vtkusers
mailing list