[vtkusers] Get a VTKRender to draw inside an external QWidget (ver5) (or QOpenGLWidget)

Elvis Stansvik elvis.stansvik at orexplore.com
Sat Sep 15 14:12:38 EDT 2018


Ah thanks. Sounds like something that would be useful in upstream VTK,
so that QVTKOpenGL*Widget could be leveraged by PyQt (or PySide2?)
developers. The old QVTKRenderWindowInteractor is less than ideal, and
it would be good to have something "official", so that not everyone
runs off and do their own thing (duplicated effort).

Elvis
Den lör 15 sep. 2018 kl 16:16 skrev Andras Lasso <lasso at queensu.ca>:
>
> The Qt OpenGL widget is Python-wrapped in CTK using PythonQt. The view widget has several improvements over the plain VTK widget, such as scheduleRender infrastructure to optimize calling of render() after changes in the VTK pipeline.
>
> http://www.commontk.org
>
> It is used in 3D Slicer, MITK, etc.
>
> Andras
> ________________________________
> From: David Gobbi <david.gobbi at gmail.com>
> Sent: Saturday, September 15, 2018 9:58 AM
> To: Elvis Stansvik
> Cc: VTK Users
> Subject: Re: [vtkusers] Get a VTKRender to draw inside an external QWidget (ver5) (or QOpenGLWidget)
>
> Hi Elvis,
>
> QVTKOpenGLWidget is not available in Python, it would have to be
> wrapped with sip (or shiboken) rather than with the stock VTK wrappers.
>
> The old QVTKWidget was, at one point, wrapped in Python as shown here:
> https://gitlab.kitware.com/vtk/vtk/commit/d487197
>
> It's totally feasible to do something similar with QVTKOpenGLWidget, if
> someone wants to dedicate the time.
>
>  - David
>
>
> On Sat, Sep 15, 2018 at 6:06 AM Elvis Stansvik <elvis.stansvik at orexplore.com> wrote:
>>
>>
>> I came across this thread while trying to find a QOpenGLWidget based
>> VTK/PyQt5 widget.
>>
>> Just want to ask: The QVTKOpenGLWidget suggested here is not available
>> from Python right? (since it's not a vtkObject).
>>
>> The OP asked about Python, and I'm sort of in the same boat.
>>
>> Elvis
>>
>> >
>> > Regards,
>> > Martijn
>> >
>> >
>> >
>> >
>> >
>> > Op 22 feb. 2018 21:10 schreef "Steve Petruzza" <spetruzza at sci.utah.edu>:
>> >>
>> >> Hi,
>> >>
>> >> I have a QOpenGLWidget that draws using gl calls. I would like to use a VTK render to draw inside the same canvas.
>> >>
>> >> I tried to use a QVTKRenderWindowInteractor passing the canvas as parent, but the canvas starts flickering and I cannot see any rendering.
>> >> The same VTK render (using the same QVTKRenderWindowInteractor) works correctly in a separate vtkrenderwindow.
>> >>
>> >> Is there any simple way to just get the VTKRender to draw directly into the glRender loop of the canvas using the existing rendering window?
>> >> Or any other suggestions.
>> >>
>> >> I am using VTK 8.1.0 and Qt 5.10 and this QVTKRenderWindowInteractor: https://gitlab.kitware.com/alextsui05/vtk/blob/e9e9ffcfbbad68343a0782a1d9024735b7649a46/Wrapping/Python/vtk/qt5/QVTKRenderWindowInteractor.py
>> >>
>> >> Thank you,
>> >> Steve


More information about the vtkusers mailing list