I’m trying to figure out how to make full screen on macOS. My configuration is:
macOS Monterey
Version 12.4
MacBook Pro (13-inch, M1, 2020)
Apple M1 chip
platform.python_version: 3.9.10
platform.machine: x86_64
base.win.gsg.driver_vendor: Apple
base.win.gsg.driver_renderer: Apple M1
base.win.gsg.supports_basic_shaders: True
PandaSystem.version_string: 1.10.11
Generally, I am aware that there are some problems with fullscreen (especially on macOS). I’ve seen a lot of posts about it, but to be honest, I don’t really understand the solutions they contain, or I don’t have how to apply them (I think tips like update drivers for the Nvidia card are of little use in my case).
My first attempt was according to the documentation which suggested enabling fullscreen in Config.prc
. So I turned on:
fullscreen #t
Unfortunately, I got a crash at startup:
Known pipe types:
CocoaGraphicsPipe
(all display modules loaded.)
:display:cocoadisplay(error): Could not find a suitable display mode!
:ShowBase(warning): Unable to open 'onscreen' window.
Traceback (most recent call last):
File "/Users/miklesz/PycharmProjects/PointCloud/main.py", line 943, in <module>
base = ShowBase()
File "/Users/miklesz/PycharmProjects/PointCloud/venv/lib/python3.9/site-packages/direct/showbase/ShowBase.py", line 339, in __init__
self.openDefaultWindow(startDirect = False, props=props)
File "/Users/miklesz/PycharmProjects/PointCloud/venv/lib/python3.9/site-packages/direct/showbase/ShowBase.py", line 1024, in openDefaultWindow
self.openMainWindow(*args, **kw)
File "/Users/miklesz/PycharmProjects/PointCloud/venv/lib/python3.9/site-packages/direct/showbase/ShowBase.py", line 1059, in openMainWindow
self.openWindow(*args, **kw)
File "/Users/miklesz/PycharmProjects/PointCloud/venv/lib/python3.9/site-packages/direct/showbase/ShowBase.py", line 804, in openWindow
raise Exception('Could not open window.')
Exception: Could not open window.
Process finished with exit code 1
Then I tried enabling full screen in runtime:
props = WindowProperties()
props.set_fullscreen(True)
base.win.request_properties(props)
There was no crash, but there was no effect either. Instead there was an error message:
Known pipe types:
CocoaGraphicsPipe
(all display modules loaded.)
:display:cocoadisplay(error): Could not find a suitable display mode with size 800x600!
I tried to change the window size to several popular and known resolutions, including the popular full-screen (1920x1080) or the native resolution of my display (2560x1600), but with the same effect as above. In the end I decided to “get” display sizes:
props = WindowProperties()
props.set_size(base.pipe.get_display_width(), base.pipe.get_display_height())
props.set_fullscreen(True)
base.win.request_properties(props)
This finally allowed to set fullscreen, but unfortunately nothing is displayed, and on stdout
I read:
Known pipe types:
CocoaGraphicsPipe
(all display modules loaded.)
:display:gsg:glgsg(error): GL error 0x506 : invalid framebuffer operation
:display:gsg:glgsg(error): An OpenGL error has occurred. Set gl-check-errors #t in your PRC file to display more information.
:display:gsg:glgsg(error): GL error 0x506 : invalid framebuffer operation
:display:gsg:glgsg(error): An OpenGL error has occurred. Set gl-check-errors #t in your PRC file to display more information.
As suggested, in Config.prc
I have set:
gl-check-errors #t
This made the display of more detailed information about the errors, but from my perspective equally unhelpful:
Known pipe types:
CocoaGraphicsPipe
(all display modules loaded.)
:display:gsg:glgsg(error): at 3820 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 5465 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 5465 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display:gsg:glgsg(error): at 4936 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid framebuffer operation
:display(error): Deactivating CocoaGraphicsStateGuardian.
So right now, the only solution I found for macOS is to maximize the window in the area between the top system bar and the bottom dock, which I do as follows:
props = WindowProperties()
props.set_size(base.pipe.get_display_width(), base.pipe.get_display_height())
props.setOrigin((0, 0))
base.win.request_properties(props)
As a result, I have almost fullscreen, although unfortunately I lose a lot of space for the top system bar, the top bar of the window and the bottom dock:
In the screenshot, the window area is black, but this is only because there was nothing there when the screenshot was taken - normally everything renders properly there.
Interestingly, I can manually click the green circle ‘<>’ in the corner of the window to enter fullscreen. Then fullscreen actually turns on, although there is another problem - a bit incorrect aspect ratio. The image is stretched vertically - as if Panda3D only stretched the window vertically, and did not add an image to the area previously occupied by bars and docks.
Can anyone tell me some better solutions? Ideally, they should work cross-platform (at least macOS + Windows, optimally macOS + Windows + Linux). But as there are no cross-platform solutions, I can always do it on conditional statements after the platform is detected. At the same time, there is no major problem for Windows - the problems are on macOS.