I hope you are well. We have an application where we use Qt and VTK. We’ve recently upgraded our application to VTK 9.0, first of all, thanks for these new functionalities, such as PBR. They are amazing. Due to this migration, we had to re-implemented several functionalities, one of those was the usage of QVTKOpenGLNativeWidget. During the transition, we found several problems related to “black screen” issues affected the rendering window of the application. For example, we have overlay Qt widgets (buttons) over the rendering screen, and we had an issue where the rendering screen turned black when the focus (in/out) event of the widgets was triggered. Another situation the rendering window turned all black was when the mouse was placed in any other widget NOT part of the rendering window, for example, a CheckBox. All these issues where solved. Despite this, I’m still having time to time a flicker effect that I cannot identify where it comes from. It happens when there is mouse interaction, but I couldn’t identify yet a way to always reproduce it.
In our application, we use a vtkInteractorStyle to override mouse event buttons. Inside those events, we use vtkInteractorObserver::GrabFocus and vtkInteractorObserver::ReleaseFocus at the beginning and end of events, respectively. I noticed that if I don’t release the focus of events the flicker effect disappears. Maybe this can be a hint for someone that found a similar issue or know something that can lead me towards a path of solution. Another weird thing is that if I disable the erasing of the renderer (vtkRenderer::EraseOff), the effect still produces.
Any ideas will be welcome.
These two implementation are feature identical with two exceptions :
QVTKOpenGLStereoWidget supports stereo rendering (eg: 3D NVIDIA Glasses) but QVTKOpenGLNativeWidget does not.
QVTKOpenGLNativeWidget supports being a native widget while QVTKOpenGLStereoWidget does not, so it should be used in this case, which is forced by Qt in certain context, like QScrollArea-contained widget.
Other than that, there is a few bugs with each implementation, including a prominent one with QVTKOpenGLStereoWidget as its design seems to be uncommon and sometimes not well supported by graphic driver.
Thanks, Mathieu. No need to go deeper, I was just wondering which is my best option to use. In this case QVTKOpenGLNativeWidget is enough. I tried your suggestion of using QVTKOpenGLStereoWidget, unfortunately it doesn’t solve the flicker issue.
As I mentioned before, in our application we use a vtkInteractorStyle to override mouse event buttons. Inside those events, we use vtkInteractorObserver::GrabFocus and vtkInteractorObserver::ReleaseFocus at the beginning and end of mouse/keyboards events, respectively. I have a solid clue that if I don’t release the focus of events the flicker effect disappears. Do you know by any chance what can be causing this behavior? I know that getting/lossing focus on Qt can trigger repaint calls, could this be related somehow?
Sorry, we reworked the whole codebase and eventually stopped reproducing, this is in v9.2.6. The issue was reproduced in initial v9 releases as far as I remember.