<div dir="ltr"><div><div><div>Hi Taylor,<br><br></div>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<span class=""></span>. I also suggest you apply the pull request #2 [2] (patch [3]) or the rendering won't update correctly under Linux.<br>
<br> [1]: <a href="https://github.com/Kitware/openview">https://github.com/Kitware/openview</a><br> [2]: <a href="https://github.com/Kitware/openview/pull/2">https://github.com/Kitware/openview/pull/2</a><br> [3]: <a href="https://github.com/Kitware/openview/pull/2.patch">https://github.com/Kitware/openview/pull/2.patch</a><br>
<br></div>HTH,<br></div>-F<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 20, 2014 at 5:58 PM, Taylor Braun-Jones <span dir="ltr"><<a href="mailto:taylor@braun-jones.org" target="_blank">taylor@braun-jones.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have solved the problem (and updated the GitHub Gist). This is what my QVTKFrameBufferObjectRenderer::render() method looks like now:<div>
<br></div><div><div><font face="courier new, monospace"> // Fix for differences in GL state between first call (before first</font></div>
<div><font face="courier new, monospace"> // rendering of the Qt Quick 2 Scene Graph) and second call. In order</font></div><div><font face="courier new, monospace"> // of most important to least.</font></div><div>
<font face="courier new, monospace"> glUseProgram(0); // crucial for the cone to show up at all after the first render</font></div><div><font face="courier new, monospace"> glDisable(GL_DEPTH_TEST); // depth buffer fighting between the cone and the background without this</font></div>
<div><font face="courier new, monospace"> glDisable(GL_BLEND); // doesn't seem crucial (?) but it is one of the differences that showed up in apitrace analysis</font></div><div><br></div><div> this->Render(); // vtkXOpenGLRenderWindow renders the scene to the FBO</div>
</div><div><br></div><div>But I'd still like to know the more robust, high level, elegant VTK way to do this.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Taylor<br><div><br></div><div><br></div>
</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, May 20, 2014 at 11:15 AM, Taylor Braun-Jones <span dir="ltr"><<a href="mailto:taylor@braun-jones.org" target="_blank">taylor@braun-jones.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hello vtkusers,<div><br></div><div><div>I'm working on integrating VTK in into the Qt Quick Scene Graph using an FBO approach. <br></div></div><div><br></div><div><div>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.</div>
<div><br></div><div>Here is my minimal example to demonstrate the problem I'm having:</div><div><br></div><div><a href="https://gist.github.com/nocnokneo/c3fb01bb7ecaf437f7d6" target="_blank">https://gist.github.com/nocnokneo/c3fb01bb7ecaf437f7d6</a></div>
<div><br></div><div>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)</div>
<div><br></div></div><div>Thanks in advance for any pointers or suggestions!</div><div><br></div><div>Taylor</div><div><br></div><div>PS - Here are some links to provide more context and information:</div><div><br></div>
<div>
<div>Relevant Qt Quick 2 Docs</div><div><a href="http://qt-project.org/doc/qt-5/qquickframebufferobject.html" target="_blank">http://qt-project.org/doc/qt-5/qquickframebufferobject.html</a></div><div><a href="http://qt-project.org/doc/qt-5/qsgsimpletexturenode.html" target="_blank">http://qt-project.org/doc/qt-5/qsgsimpletexturenode.html</a></div>
<div><a href="http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph-renderer.html" target="_blank">http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph-renderer.html</a></div><div><br></div><div>Presentation by James Turner at Qt Developer Days<br>
</div><div><a href="http://www.qtdeveloperdays.com/sites/default/files/presentation_pdf/james-turner-devdays-2013-talk.pdf" target="_blank">http://www.qtdeveloperdays.com/sites/default/files/presentation_pdf/james-turner-devdays-2013-talk.pdf</a> (video: <a href="https://www.youtube.com/watch?v=BfIaTccy6HQ" target="_blank">https://www.youtube.com/watch?v=BfIaTccy6HQ</a>)</div>
<div><br></div><div>Qt's example of what I'm trying to do except using "raw" OpenGL instead of VTK and not using the QQuickFramebufferObject convenience class:<br></div><div><a href="http://qt-project.org/doc/qt-5/qtquick-scenegraph-textureinsgnode-example.html" target="_blank">http://qt-project.org/doc/qt-5/qtquick-scenegraph-textureinsgnode-example.html</a></div>
</div><div><br></div></div>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Félix C. Morency, M.Sc.<br>Plateforme d’analyse et de visualisation d’images<br>Centre Hospitalier Universitaire de Sherbrooke<br>Centre de recherche clinique Étienne-Le Bel<br>
Local Z5-3031 | 819.346.1110 ext 16634 </div>
</div>