Closed GenieTim closed 1 year ago
That's an odd fix, but nice finding
Does it work for you to set the fix you set in show
but to keep the QSurfaceFormat
code in View
, so using View
as a widget in a Qt application still brings its own GL settings ?
If so, we should do the following:
# module level in rendering
def qt_surface_format():
fmt = QSurfaceFormat()
fmt.setVersion(*opengl_version)
fmt.setProfile(QSurfaceFormat.OpenGLContextProfile.CoreProfile)
fmt.setSamples(4)
return fmt
# in show(), before QApplication init
QSurfaceFormat.setDefaultFormat(qt_surface_format())
# in View.__init__()
self.setFormat(qt_surface_format())
Yes, that absolutely works.
Hello @GenieTim We didn't received confirmations that this is working from other macos users, I'm not sure whether no one attempted it, or if some one with this problem found this PR and used that solution without subscribing to github to mention it.
I'm going to merge this anyway since it fixed the issue at least for you ;)
Hi @jimy-byerley, I'm also seeing that issue and want to help test. I can't seem to get the branch to run locally. Would it be possible to publish a version that I could pip install and try? Thank you!
Sure I should publish a fix version however if the master branch doesn't run on your side, it will ikely be the same with the published version
What was the console output when you tried the master
branch ?
I wasnt able to build it. clang: error: no such file or directory: 'madcad/core.c'
but admittedly a lot of this is far beyond my understanding :)
Ah, this is only because you didn't installed the build requirements: cython
you can pip install it as well as the runtime dependencies and the compilation should proceed.
Cool that indeed worked! The master branch works on my macbook m1 including the show
function!
Thank you!
Youre welcome ;)
This is the reduced fix for MacOS, this time without also upgrading PyQt to 6.
This is what's required on my device. Without it, I still get the division by zero error. The change on line 767 is not strictly necessary.
It's possible that there are other ways to achieve what I do here, I am not particularly familiar with OpenGL or PyQt, just got to this answer thanks to this forum post: https://forum.qt.io/topic/75759/qopengl-on-mac-qcocoaglcontext-falling-back-to-unshared-context/3