[vtkusers] Integrating with Qt Quick by rendering VTK to a Framebuffer Object (FBO)

Taylor Braun-Jones taylor at braun-jones.org
Tue May 20 17:58:55 EDT 2014


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140520/f59a1538/attachment.html>


More information about the vtkusers mailing list