[vtkusers] QVTKOpenGLWidget - update() or GetRenderWindow()->Render()

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Jun 19 10:38:08 EDT 2018


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://gitlab.kitware.com/vtk/vtk/commit/4c77c46025e737ad66e0b797a759e73d81c9f240"
>
> 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 www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list