Discussion:
[vtkusers] Custom VTK Cocoa window flickers gray on new macOS
Alessandro Volz
2018-11-13 11:11:33 UTC
Permalink
Hi,

I am a contributor to the Horos project (the FOSS inherited from OsiriX). In this project, we use VTK for the Volume Rendering window. When I say 'custom', I mean that we assign our own NSView and NSWindow to the vtkCocoaRenderWindow (through SetWindowId and SetRootWindow), and initialize the vtkRenderWindowInteractor inside the first drawRect: call.

With the latest macOS update we have this strange behavior in the VR window. Somehow, the VTK render sometimes doesn't successfully get drawn on screen:
- the window is initially gray
- when resizing, it flickers between gray and render
- when calling the underlying interactor, the resulting updated image is rendered on screen (for example when rotating).

Do you have any advice how to fix this?

Thanks,

Alessandro

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Sean McBride
2018-11-13 18:34:55 UTC
Permalink
Post by Alessandro Volz
I am a contributor to the Horos project (the FOSS inherited from
OsiriX). In this project, we use VTK for the Volume Rendering window.
When I say 'custom', I mean that we assign our own NSView and NSWindow
to the vtkCocoaRenderWindow (through SetWindowId and SetRootWindow), and
initialize the vtkRenderWindowInteractor inside the first drawRect: call.
With the latest macOS update we have this strange behavior in the VR
window. Somehow, the VTK render sometimes doesn't successfully get drawn
- the window is initially gray
- when resizing, it flickers between gray and render
- when calling the underlying interactor, the resulting updated image is
rendered on screen (for example when rotating).
Do you have any advice how to fix this?
When you say new macOS, which do you mean? 10.14.1 vs 10.14? 10.14.x vs 10.13.x?

Could you try to create a repro case based on the SimpleCocoaVTK example?

Our usage of VTK is similar, but we haven't seen this issue.

Cheers,
--
____________________________________________________________
Sean McBride, B. Eng ***@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Alessandro Volz
2018-11-13 19:06:37 UTC
Permalink
Hi, thanks for your reply,

I mean, from 10.13 to 10.14, no change in 10.14.1.

We also noticed this only happens when linking against the 10.14 SDK (Xcode 10.x) or with dark mode support enabled on Xcode 9.3.x (through the Info.plist).

I can try reproduce, no guarantee. It’ll also take me a while to do, so if anyone has any pointers, please please :)

Alessandro
Post by Sean McBride
Post by Alessandro Volz
I am a contributor to the Horos project (the FOSS inherited from
OsiriX). In this project, we use VTK for the Volume Rendering window.
When I say 'custom', I mean that we assign our own NSView and NSWindow
to the vtkCocoaRenderWindow (through SetWindowId and SetRootWindow), and
initialize the vtkRenderWindowInteractor inside the first drawRect: call.
With the latest macOS update we have this strange behavior in the VR
window. Somehow, the VTK render sometimes doesn't successfully get drawn
- the window is initially gray
- when resizing, it flickers between gray and render
- when calling the underlying interactor, the resulting updated image is
rendered on screen (for example when rotating).
Do you have any advice how to fix this?
When you say new macOS, which do you mean? 10.14.1 vs 10.14? 10.14.x vs 10.13.x?
Could you try to create a repro case based on the SimpleCocoaVTK example?
Our usage of VTK is similar, but we haven't seen this issue.
Cheers,
--
____________________________________________________________
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/
Sean McBride
2018-11-14 16:57:19 UTC
Permalink
Post by Alessandro Volz
Hi, thanks for your reply,
I mean, from 10.13 to 10.14, no change in 10.14.1.
We also noticed this only happens when linking against the 10.14 SDK
(Xcode 10.x) or with dark mode support enabled on Xcode 9.3.x (through
the Info.plist).
That being the case, it could be a macOS bug. No harm filing a ticket with Apple:
<https://bugreporter.apple.com>
Post by Alessandro Volz
I can try reproduce, no guarantee. It’ll also take me a while to do, so
if anyone has any pointers, please please :)
Did you try on various Mac models? Perhaps it's only with certain GPUs?

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng ***@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/lis
Sean McBride
2018-11-16 15:34:22 UTC
Permalink
Post by Alessandro Volz
I mean, from 10.13 to 10.14, no change in 10.14.1.
We also noticed this only happens when linking against the 10.14 SDK
(Xcode 10.x) or with dark mode support enabled on Xcode 9.3.x (through
the Info.plist).
I can try reproduce, no guarantee. It’ll also take me a while to do, so
if anyone has any pointers, please please :)
Another thought: do any of VTK's existing unit tests exhibit the problem?

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng ***@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.k
Alessandro Volz
2018-11-16 21:52:11 UTC
Permalink
Hi again,

I actually came around and got the SimpleCocoaVTK example to build against my VTK libs.

Is it supposed to just show a gray window with two "Do Something" buttons? I suppose not.

So, chances are, I'm building VTK the wrong way. Here is my CMake:

cmake /Users/ale/Work/VTK -DVTK_USE_X:BOOL=OFF -DVTK_USE_COCOA:BOOL=ON -DBUILD_DOCUMENTATION=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DVTK_Group_StandAlone=OFF -DVTK_Group_Rendering=OFF -DModule_vtkIOImage=ON -DModule_vtkFiltersGeneral=ON -DModule_vtkImagingMorphological=ON -DModule_vtkImagingStencil=ON -DModule_vtkRenderingOpenGL2=ON -DModule_vtkRenderingVolumeOpenGL2=ON -DModule_vtkRenderingAnnotation=ON -DModule_vtkInteractionWidgets=ON -DModule_vtkIOGeometry=ON -DModule_vtkIOExport=ON -DModule_vtkFiltersTexture=ON -DModule_vtktiff=ON -DVTK_USE_SYSTEM_ZLIB:BOOL=ON -DVTK_USE_SYSTEM_EXPAT=ON -DVTK_USE_SYSTEM_LIBXML2=ON -DCMAKE_INSTALL_PREFIX=/Users/ale/Work/VTK-Install -DVTK_INSTALL_INCLUDE_DIR=include '-DCMAKE_CXX_FLAGS=-w -fvisibility=default -stdlib=libc++ -std=c++0x'

Do you see anything suspicious?

Could you build the SimpleCocoaVTK on your mac, zip it up and send it to me, to test if the problem is at hardware level or at build level?

Best,

Alessandro
Post by Sean McBride
Post by Alessandro Volz
I mean, from 10.13 to 10.14, no change in 10.14.1.
We also noticed this only happens when linking against the 10.14 SDK
(Xcode 10.x) or with dark mode support enabled on Xcode 9.3.x (through
the Info.plist).
I can try reproduce, no guarantee. It’ll also take me a while to do, so
if anyone has any pointers, please please :)
Another thought: do any of VTK's existing unit tests exhibit the problem?
Cheers,
--
____________________________________________________________
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
Alessandro Volz
2018-11-17 12:47:54 UTC
Permalink
After some off-list exchanges, I want to get this thread back on the mailing list.

There is indeed a problem that also comes up with the SimpleCocoaVTK sample project. In Mojave, when built using the 10.14 SDK, SimpleCocoaVTK opens without displaying the rendered images. Interacting with the view displays the results.
If you modify the project so the views are resized along with the window, the problem gets worse. When resizing, the render will flicker while resizing, and the result after resizing will depend on the latest state.

Generally speaking, it seems to me, it works until you call [MyVTKView setNeedsDisplay:YES] or [MyVTKView display]. I also feel like this problem has something to do with double buffering, but I haven't gotten around it.

This thread suggests a solution: https://stackoverflow.com/questions/52938516/opengl-not-rendering-on-macos-mojave <https://stackoverflow.com/questions/52938516/opengl-not-rendering-on-macos-mojave>
But that doesn't fix it for us. However, it explains the changes that are probably causing the problem.

Other OpenGL-on-Mojave-related threads I found suggest calling [NSOpenGLContext update] at the right moments to fix it. I've tried, I've failed.

Any suggestions?

Thanks,

Alessandro
Post by Alessandro Volz
Hi again,
I actually came around and got the SimpleCocoaVTK example to build against my VTK libs.
Is it supposed to just show a gray window with two "Do Something" buttons? I suppose not.
cmake /Users/ale/Work/VTK -DVTK_USE_X:BOOL=OFF -DVTK_USE_COCOA:BOOL=ON -DBUILD_DOCUMENTATION=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DVTK_Group_StandAlone=OFF -DVTK_Group_Rendering=OFF -DModule_vtkIOImage=ON -DModule_vtkFiltersGeneral=ON -DModule_vtkImagingMorphological=ON -DModule_vtkImagingStencil=ON -DModule_vtkRenderingOpenGL2=ON -DModule_vtkRenderingVolumeOpenGL2=ON -DModule_vtkRenderingAnnotation=ON -DModule_vtkInteractionWidgets=ON -DModule_vtkIOGeometry=ON -DModule_vtkIOExport=ON -DModule_vtkFiltersTexture=ON -DModule_vtktiff=ON -DVTK_USE_SYSTEM_ZLIB:BOOL=ON -DVTK_USE_SYSTEM_EXPAT=ON -DVTK_USE_SYSTEM_LIBXML2=ON -DCMAKE_INSTALL_PREFIX=/Users/ale/Work/VTK-Install -DVTK_INSTALL_INCLUDE_DIR=include '-DCMAKE_CXX_FLAGS=-w -fvisibility=default -stdlib=libc++ -std=c++0x'
Do you see anything suspicious?
Could you build the SimpleCocoaVTK on your mac, zip it up and send it to me, to test if the problem is at hardware level or at build level?
Best,
Alessandro
Post by Sean McBride
Post by Alessandro Volz
I mean, from 10.13 to 10.14, no change in 10.14.1.
We also noticed this only happens when linking against the 10.14 SDK
(Xcode 10.x) or with dark mode support enabled on Xcode 9.3.x (through
the Info.plist).
I can try reproduce, no guarantee. It’ll also take me a while to do, so
if anyone has any pointers, please please :)
Another thought: do any of VTK's existing unit tests exhibit the problem?
Cheers,
--
____________________________________________________________
Rogue Research www.rogue-research.com <http://www.rogue-research.com/>
Mac Software Developer Montréal, Québec, Canada
Sean McBride
2018-11-19 20:34:27 UTC
Permalink
Post by Alessandro Volz
After some off-list exchanges, I want to get this thread back on the mailing list.
There is indeed a problem that also comes up with the SimpleCocoaVTK
sample project. In Mojave, when built using the 10.14 SDK,
SimpleCocoaVTK opens without displaying the rendered images. Interacting
with the view displays the results.
On a hunch, I updated my 10.14 bot from macOS 10.14.1 to 10.14.2beta3, and the bug is fixed!

Perhaps you guys could do the same to confirm?

Cheers,
--
____________________________________________________________
Sean McBride, B. Eng ***@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Loading...