[vtkusers] VTK and QtQuick 2
Olivier COMAS
ocomas at apelem.com
Fri Jan 15 05:26:00 EST 2016
Hi,
I will answer my own question. It might help someone one day.
So for those interested, I managed to make it work. In the
QVTKFrameBufferObjectItem class, I used a vtkExternalOpenGLRenderWindow
instead of a vtkGenericOpenGLRenderWindow. I passed directly the
vtkExternalOpenGLRenderWindow object to the
QVTKFramebufferObjectRenderer's constructor. No need to define a
vtkInternalOpenGLRenderWindow anymore. And in the render() method of
QVTKFramebufferObjectRenderer I simply call Render() on this
vtkExternalOpenGLRenderWindow object (no push/pop state nor
OpenGlInitState). It works with VTK 7.0 rc (and therefore the "new"
OpenGL2 backend of VTK). I'm not sure it's the way that
QVTKFrameBufferObjectItem and vtkExternalOpenGLRenderWindow are intented
to be combined, but it works...
Cheers,
Olivier
> On 11/01/2016 13:12:35, Olivier Comas <ocomas at apelem.com> wrote:
>
> Hi everyone,
>
> I was wondering if anyone managed to integrate VTK and Qt Quick 2. I
> found this post:
> https://gist.github.com/nocnokneo/c3fb01bb7ecaf437f7d6 which gives an
> example of integration. And it works great with VTK 6.3. But using the
> OpenGL2 backend in 6.3 or using VTK 7.0 rc, it crashes in
> OpenGLInitState() at the first OpenGL call. Even a call to
> “glEnable(GL_DEBUG_OUTPUT);” crashes. I checked the handle returned by
> wglGetCurrentContext() and it’s not NULL so it seems to have a valid
> OpenGL context. That would be awesome to be able to use the “new” VTK
> rendering backend along with a GUI made with Qt Quick 2.
>
> I also found this post from Kitware:
> http://www.kitware.com/blog/home/post/688. If I understand correctly,
> ExternalVTKWidgetseems to be a helper class for making it easier to
> use vtkExternalOpenGLRenderWindow, vtkExternalOpenGLRenderand
> vtkExternalOpenGLCamera. But I could not find any working example. How
> is it supposed to be used? Could we use those classes in a class
> inheriting from QWindow so VTK can use the OpenGL context created by
> Qt? It is how those classes are intented to be used?
>
> Do you intend to release a QVTKQuickItem or QVTKWindow at some point?
> I know there is a QVTKWidget but there is nothing for Qt Quick. From
> my understanding, ExternalVTKWidgetcould be used for QtQuick
> integration. So do you intent to release a class to support QtQuick?
> An example on how to use ExternalVTKWidgetwould be great already.
>
> Any help would be greatly appreciated.
>
> Regards,
>
> Olivier
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160115/55b88e3a/attachment.html>
More information about the vtkusers
mailing list