gkv311 / occt-samples-qopenglwidget

Open CASCADE Technology sample - 3D Viewer within Qt Widgets window
Other
55 stars 16 forks source link

MacOS Compatibility #7

Closed winzlebee closed 2 years ago

winzlebee commented 2 years ago

Hi @gkv311,

We're looking for any potential pointers for getting this working with MacOS

We maintain a cross-platform application and integrate this component using Qt 5.15.2 We are using OpenCascade 7.6.1

While the component works well on Linux and Windows, on MacOS it seems to have some issues. From the log, the OpenGL context initialises correctly and all FBO creation calls succeed. The off-screen FBO also seems to be drawn to correctly, as V3d_View::Dump outputs an image that is correct.

To prevent crashing with a shared OpenGL context on MacOS, as per the Qt Docs, we need to setup the default surface format before QApplication is created. MacOS only supports OpenGL 4.1, so the GL_KHR_DEBUG extension is not available to us unfortunately.

Currently this results in a black screen, with no useful debug output

Any pointers or clues would be appreciated, or a better method of debugging these graphics issues on MacOS?

gkv311 commented 2 years ago

To prevent crashing with a shared OpenGL context on MacOS

I don't get it - does it crash or doesn't draw anything without any message?

winzlebee commented 2 years ago

Sorry, I was just referring to the requirement of setting QSurfaceFormat::setDefaultFormat At the start, as you have in your latest commit. Without this, we get a crash.

Once we have it in, we don’t get a crash but instead a black screen. When I have access to the machine again I’ll test your latest changes

There are no log messages to indicate anything wrong along with the black screen.

gkv311 commented 2 years ago

You will need the following OCCT patch for running on macOS. I haven't seen any crash though, just a blank viewer.

Screenshot 2022-05-31 at 07 18 48

winzlebee commented 2 years ago

You will need the following OCCT patch for running on macOS

I've build OCCT at 6cdbd6a0e5db9c6ab7b84ef4cf41d0b5a36433c9 and it indeed does work perfectly now. Thanks for that!

If this is a suitable spot to ask, is it planned to release a minor OCCT 7.6.x update for this or will this arrive with OCCT 7.7.X? The patch does not appear to cleanly apply to the 7.6.x tree

gkv311 commented 2 years ago

It is not the right place to ask about OCCT releases - this is just a small sample project based on OCCT.