[vtkusers] Integrating with Qt Quick by rendering VTK to a Framebuffer Object (FBO)
Félix C. Morency
felix.morency at gmail.com
Wed May 21 10:45:19 EDT 2014
Taylor,
Sorry that I can't help more, although I would be interested in the
solution when it comes up.
Thanks,
-F
On Tue, May 20, 2014 at 7:11 PM, Taylor Braun-Jones
<taylor at braun-jones.org>wrote:
> Hi Felix,
>
> I'm actually already using OpenView core. I should have mentioned this.
> I'm looking for a solution to
>
> (1) better integrate with the Qt Quick 2 Scene Graph (e.g. layering both
> under and over other Qt Quick components and applying any property that is
> supported by QQuickItem like opacity, rotation, animations, etc)
> (2) help deal with multi-threading issues that VTK wasn't designed for
> (caused by the fact the the Qt Quick 2 Scene Graph does all OpenGL
> rendering in a dedicated render thread, separate from the main thread)
>
> Taylor
>
>
> On Tue, May 20, 2014 at 6:57 PM, Félix C. Morency <felix.morency at gmail.com
> > wrote:
>
>> Hi Taylor,
>>
>> It might not be exactly what you want but I suggest you take a look at
>> the Kitware OpenView sources [1], more precisely the QVTKQuickItem. I
>> also suggest you apply the pull request #2 [2] (patch [3]) or the rendering
>> won't update correctly under Linux.
>>
>> [1]: https://github.com/Kitware/openview
>> [2]: https://github.com/Kitware/openview/pull/2
>> [3]: https://github.com/Kitware/openview/pull/2.patch
>>
>> HTH,
>> -F
>>
>>
>> On Tue, May 20, 2014 at 5:58 PM, Taylor Braun-Jones <
>> taylor at braun-jones.org> wrote:
>>
>>> I have solved the problem (and updated the GitHub Gist). This is what
>>> my QVTKFrameBufferObjectRenderer::render() method looks like now:
>>>
>>> // Fix for differences in GL state between first call (before first
>>> // rendering of the Qt Quick 2 Scene Graph) and second call. In
>>> order
>>> // of most important to least.
>>> glUseProgram(0); // crucial for the cone to show up at
>>> all after the first render
>>> glDisable(GL_DEPTH_TEST); // depth buffer fighting between the
>>> cone and the background without this
>>> glDisable(GL_BLEND); // doesn't seem crucial (?) but it is
>>> one of the differences that showed up in apitrace analysis
>>>
>>> this->Render(); // vtkXOpenGLRenderWindow renders the scene to the
>>> FBO
>>>
>>> But I'd still like to know the more robust, high level, elegant VTK way
>>> to do this.
>>>
>>> Taylor
>>>
>>>
>>>
>>>
>>> On Tue, May 20, 2014 at 11:15 AM, Taylor Braun-Jones <
>>> taylor at braun-jones.org> wrote:
>>>
>>>> Hello vtkusers,
>>>>
>>>> I'm working on integrating VTK in into the Qt Quick Scene Graph using
>>>> an FBO approach.
>>>>
>>>> I currently have something that is close, but not quite there - the
>>>> first frame rendered to the FBO by VTK works as expected - the VTK rendered
>>>> scene shows up in the Qt Quick window with correct layering and Qt Quick
>>>> Item properties and animations work like any other Qt Quick component.
>>>> Great! But then... the second time the Qt Scene graph requests VTK to
>>>> render to the FBO nothing shows up.
>>>>
>>>> Here is my minimal example to demonstrate the problem I'm having:
>>>>
>>>> https://gist.github.com/nocnokneo/c3fb01bb7ecaf437f7d6
>>>>
>>>> It includes a README.md with some simple build instructions. To trigger
>>>> a second VTK-render-to-FBO, you can resize the window by one pixel (or
>>>> uncomment the update() call at line 64 of QVTKFrameBufferObjectItem.cpp)
>>>>
>>>> Thanks in advance for any pointers or suggestions!
>>>>
>>>> Taylor
>>>>
>>>> PS - Here are some links to provide more context and information:
>>>>
>>>> Relevant Qt Quick 2 Docs
>>>> http://qt-project.org/doc/qt-5/qquickframebufferobject.html
>>>> http://qt-project.org/doc/qt-5/qsgsimpletexturenode.html
>>>>
>>>> http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph-renderer.html
>>>>
>>>> Presentation by James Turner at Qt Developer Days
>>>>
>>>> http://www.qtdeveloperdays.com/sites/default/files/presentation_pdf/james-turner-devdays-2013-talk.pdf (video:
>>>> https://www.youtube.com/watch?v=BfIaTccy6HQ)
>>>>
>>>> Qt's example of what I'm trying to do except using "raw" OpenGL instead
>>>> of VTK and not using the QQuickFramebufferObject convenience class:
>>>>
>>>> http://qt-project.org/doc/qt-5/qtquick-scenegraph-textureinsgnode-example.html
>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>>
>> --
>> Félix C. Morency, M.Sc.
>> Plateforme d’analyse et de visualisation d’images
>> Centre Hospitalier Universitaire de Sherbrooke
>> Centre de recherche clinique Étienne-Le Bel
>> Local Z5-3031 | 819.346.1110 ext 16634
>>
>
>
--
Félix C. Morency, M.Sc.
Plateforme d’analyse et de visualisation d’images
Centre Hospitalier Universitaire de Sherbrooke
Centre de recherche clinique Étienne-Le Bel
Local Z5-3031 | 819.346.1110 ext 16634
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140521/d8aa5698/attachment.html>
More information about the vtkusers
mailing list