mayo icon indicating copy to clipboard operation
mayo copied to clipboard

No 3D rendering(black area) on macOS

Open HuguesDelorme opened this issue 2 years ago • 13 comments

Reported by @grexe in issue #151

However when trying to load a sample STEP file from nist.gov, namely this one, and opening nist_ftc_06_asme1_rd.stp, I only get a black canvas. The same file opens fine with e.g. CAD Assistant, which also uses OpenCascade.

Notice that some other user(@livigni) mentionned Mayo to run correctly on macOS(see https://github.com/fougue/mayo/issues/67#issuecomment-1137480691)

HuguesDelorme avatar Sep 19 '22 08:09 HuguesDelorme

@grexe Is there any OpenGL error prompted in the terminal when running Mayo ? Can you please post here Mayo's console output on your machine ?

As a workaround you can comment the if() block between lines 350-363 in src/app/main.cpp : https://github.com/fougue/mayo/blob/e41d872be90744e9c8efd890e163f09f1d7c8c01/src/app/main.cpp#L350 Build and run again

HuguesDelorme avatar Sep 19 '22 08:09 HuguesDelorme

This is the output I get (using MacOS 12.6 (21G115)):

gregor@Gregors-MacBook-Pro mayo.app % ./Contents/MacOS/mayo
DEBUG: OpenCascade settings file doesn't exist or is not readable [path=opencascade.conf]
INFO: OpenGL v2.1
WARNING: Back buffer dpr of 2 doesn't match <_NSViewBackingLayer: 0x60000170cb40> contents scale of 1 - updating layer to match.
WARNING: Back buffer dpr of 2 doesn't match <_NSViewBackingLayer: 0x60000170c270> contents scale of 1 - updating layer to match.
WARNING: Back buffer dpr of 2 doesn't match <_NSViewBackingLayer: 0x60000171a820> contents scale of 1 - updating layer to match.
WARNING: Back buffer dpr of 2 doesn't match <_NSViewBackingLayer: 0x600001718120> contents scale of 1 - updating layer to match.

will try the code change later.

grexe avatar Sep 19 '22 11:09 grexe

Hello @HuguesDelorme & @grexe

I was experiencing this same issue on MacOS 13.0.1 (22A400), I followed your advice to comment out the block in main.cpp under the comment "// Use QOpenGLWidget if possible"

All is working fine now. Looking good.

zambetti avatar Feb 02 '23 01:02 zambetti

@HuguesDelorme comment fixed it, on OS X Big Sur. Thanks!

jhillhouse92 avatar Mar 07 '23 01:03 jhillhouse92

@zambetti and @grexe Please try new option Force OpenGL fallback widget to tweak OpenGL support.

HuguesDelorme avatar Mar 07 '23 15:03 HuguesDelorme

@HuguesDelorme I have just downloaded and built the latest version, and I can confirm the fallback widget works on my machine. Compliments on this nice application.

zambetti avatar Mar 07 '23 16:03 zambetti

Hi!

I had the same issue with the black screen. I tried the fallback widget option (i.e. I turned it off and restarted mayo), but that did not work for me. Commenting out the whole block in src/app/main.cpp, i.e.:

#if OCC_VERSION_HEX >= 0x070600
...
#endif

(roughly lines 392-408) fixed my problem. Now, I can see the model.

I am on Ventura 13.1, Apple M1 chip, built mayo against Qt 6.2.4 (IDK if that matters).

andrsd avatar Mar 30 '23 19:03 andrsd

@andrsd The "fallback widget" option should be set to ON. Please check again with that option turned ON(and without the comment of course) Let me know your feedback!

HuguesDelorme avatar Mar 31 '23 10:03 HuguesDelorme

The fallback widget was originally ON. I believe that's the default (?). That's when I had the issue with black screen, so I went to look for the cause and found this issue. I can try again. I forgot to mention I built the this version: c85fe27fbfa27ba9b163b01bb54036473fa31e4f

andrsd avatar Mar 31 '23 12:03 andrsd

I tried a clean build of c85fe27fbfa27ba9b163b01bb54036473fa31e4f, made sure the Fallback widget was ON and all works as expected. Hmmm... 🤔

andrsd avatar Mar 31 '23 13:03 andrsd

@andrsd I confirm the forceOpenGlFallbackWidget option is set to ON for macOS by default. https://github.com/fougue/mayo/blob/c85fe27fbfa27ba9b163b01bb54036473fa31e4f/src/app/app_module_properties.cpp#L87

I don't like this option, it's preferrable to fix the OpenGL framebuffer rendering with Qt for macOS But until this gets fixed, seem like for macOS this workaround is required.

HuguesDelorme avatar Mar 31 '23 15:03 HuguesDelorme

This is a pure guess and I might be totally wrong, but could it be that because MainWindow is created before appModule->settings()->resetAll(); is called, then on a clean machine (i.e. machine where mayo was never run before) for the first time the setting is not applied which would cause the black screen?

andrsd avatar Mar 31 '23 16:03 andrsd

@andrsd You might have spotted a potential issue, I need to check this. The forceOpenGlFallbackWidget setting is explicitly loaded here: https://github.com/fougue/mayo/blob/925403f13a3c5f6642c4f3812000ea4b8551514c/src/app/main.cpp#L394 But for some reason this could fail on the very first execution of Mayo

HuguesDelorme avatar Apr 01 '23 17:04 HuguesDelorme