QtVtk icon indicating copy to clipboard operation
QtVtk copied to clipboard

Doesn't seem to work with the version of VTK that ships with ParaView 5.8

Open waj334 opened this issue 4 years ago • 7 comments

Has anyone gotten this to work with a recent version of VTK? All I get is a white background and a open button. It seems to load in models, but rendering is not working.

waj334 avatar Apr 07 '20 15:04 waj334

Decided to run my program attached to RenderDoc to see what's going on and found that VTK renders ok on the first color pass, but then Qt Quick starts the second pass by rendering a filled quad on the entire viewport. I haven't found a way to make Qt Quick not do that.

waj334 avatar Apr 08 '20 22:04 waj334

Upon further testing, my assumption above was incorrect. The problem is vtkGenericOpenGLRenderWindow::Start binds it's own frame buffer after Qt Quick had already bound the one to be rendered in. So I reimplemented vtkGenericOpenGLRenderWindow::Start to re-bind Qt Quicks fbo and it renders something.

waj334 avatar Apr 08 '20 23:04 waj334

@waj334 How did you do that? You re implemented vtkGenericOpenGLRenderWindow::Start in VTK and recompiled that?

latnec avatar Apr 14 '20 17:04 latnec

I guess "overrode" would have been a better word to use. I inherited vtkGenericOpenGLRenderWindow from a new class and overrode vtkGenericOpenGLRenderWindow::Start function to make it re-bind the FBO coming from Qt Quick and I overrode vtkGenericOpenGLRenderWindow::End to make it do absolutely nothing. The only problem I ran into after that is the clear color set by VTK didn't work properly, so I just let Qt Quick clear it's frame buffer using the color set in VTK. The end result looked perfectly fine.

waj334 avatar Apr 15 '20 17:04 waj334

@waj334 Thank you for the reply. I think I've tried that with no success. Any chance you can make a branch?

Btw, I am using Qt 5.12, latest VTK (commit abbc884cf314c663958ee08690c6bf2fb15ebe2b).

latnec avatar Apr 15 '20 17:04 latnec

I was able to get the code running (with only 2 includes) with Qt 5.12 and VTK 6.3.0 (commit 21df122f4186aec9baae298bfc35b5a380869748).

It seems like the breaking change is in VTK.

latnec avatar Apr 17 '20 01:04 latnec

Well, this is strange. Tested and it works with

Qt 5.12 and VTK 7.1.1 (b86da7eef93f75c4a7f524b3644523ae6b651bc4) Qt 5.12 and VTK 8.0 (782d7edff3a27317506e3f144952c6437c4f658d) Qt 5.12 and VTK 8.2 (e3de2c35c9f44fd6d16ad4c6b6527de7c4f677c7)

I assume the RC have an issue?

@waj334 In my testes above, I did not have to subclass vtkGenericOpenGLRenderWindow

latnec avatar Apr 17 '20 12:04 latnec