Flicker effect/black screen issue with QVTKOpenGLNativeWidget

Hi,

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.

Regards,
Santiago.

Cc: @mwestphal @utkarshayachit

Any ideas?

You can try using the other version of the render widget :
QVTKOpenGLStereoWidget

Hi Mathieu,

Thanks for your time. Can you tell me in a few words what’s the difference between QVTKOpenGLStereoWidget and QVTKOpenGLNativeWidget?

Regards,
Santiago.

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.

I can go deeper if needed.

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?

Regards,
Santiago.

We had a similar problem. We solved it by calling Render() at the right time, before and after the code that caused the screen to go black.

Do you have more information about this particular code? Did you found a common pattern?

Hello, have you solved this question? Have I encountered this problem recently? I really hope to receive your reply. Thank you