[vtkusers] Custom VTK Cocoa window flickers gray on new macOS

Alessandro Volz alessandro.volz at gmail.com
Sat Nov 17 07:47:54 EST 2018


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


> On Nov 16, 2018, at 10:52 PM, Alessandro Volz <alessandro.volz at gmail.com> wrote:
> 
> 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
> 
>> On Nov 16, 2018, at 4:34 PM, Sean McBride <sean at rogue-research.com <mailto:sean at rogue-research.com>> wrote:
>> 
>> On Tue, 13 Nov 2018 20:06:37 +0100, Alessandro Volz said:
>> 
>>> 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                 sean at rogue-research.com <mailto:sean at rogue-research.com>
>> Rogue Research                        www.rogue-research.com <http://www.rogue-research.com/> 
>> Mac Software Developer              Montréal, Québec, Canada
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181117/bd4bd7ee/attachment.html>


More information about the vtkusers mailing list