"Could not open window" on macOS Mojave



I am having some trouble getting the latest panda3d to work on macOS Mojave. Running the asteroids example yields the following results:

$ python main.py 
Known pipe types:
(all display modules loaded.)
:display:cocoadisplay(error): Could not find a usable pixel format.
:ShowBase(warning): Unable to open 'onscreen' window.
Traceback (most recent call last):
  File "main.py", line 398, in <module>
    demo = AsteroidsDemo()
  File "main.py", line 92, in __init__
  File "/Developer/Panda3D/direct/showbase/ShowBase.py", line 274, in __init__
    self.openDefaultWindow(startDirect = False, props=props)
  File "/Developer/Panda3D/direct/showbase/ShowBase.py", line 940, in openDefaultWindow
    self.openMainWindow(*args, **kw)
  File "/Developer/Panda3D/direct/showbase/ShowBase.py", line 976, in openMainWindow
    self.openWindow(*args, **kw)
  File "/Developer/Panda3D/direct/showbase/ShowBase.py", line 725, in openWindow
    raise Exception('Could not open window.')
Exception: Could not open window.

Let me know if I can provide any additional info to help debug.



Could be related to https://github.com/panda3d/panda3d/pull/551

Try adding those lines at the top or main.py and see if it works ?

from panda3d.core import loadPrcFileData
loadPrcFileData("", "depth-bits 16\n")


Nope. Same exact error.


Do you have a multi-monitor or multi-GPU set-up? Can you run other OpenGL applications? Does setting gl-version 3 2 in your Config.prc file do anything?


I tried setting that both using Config.prc and loadPrcFileData, but no joy.

However, while browsing the Config.prc I found:

framebuffer-hardware #t
framebuffer-software #f

When I commented both out (since “If you don’t set either, it will use whatever’s available.”), I still get the save exact error. However when I reversed the values setting software to true and hardware to false, Everything works perfectly.

One particular thing to note of my configuration is that the macOS is run inside of a VMWare virtual machine.

I tested my OpenGL using a OpenGL Extensions Viewer app and all tests up to OpenGL version 4.1 completed successfully. Although 4 and 4.1 where extremely slow (to be expected in a VM).


OK, that’s the piece of information we were missing. Panda is behaving as expected, then. The default values for those variables are used if you omit them from Config.prc, but the default values are the same as the ones you see in Config.prc. You should be able to explicitly set both framebuffer-hardware and framebuffer-software yourself to true or false as desired if you don’t want to restrict yourself to a hardware framebuffer.


I am curious, is there a reason software rendering is explicitly disabled by default?

Also, reading the comments in the Config.prc:

# The framebuffer-hardware flag forces it to use an accelerated driver.
# The framebuffer-software flag forces it to use a software renderer.
# If you don't set either, it will use whatever's available.

I am lead to believe that if both are omitted, the default behavior is to allow both, but prefer hardware, which seems like a very sensible option. I’m guessing this comment is incorrect then?

Also, when I set both software and hardware to false, the example also seems to also work, making me assume that its behavior is equivalent to setting both to true. Maybe this is the intended default setting? Since that way if someone needs to explicitly allow only one of the options they only need to enable it.


The reason it’s disabled by default is because for the majority of games, software rendering is unusably slow, and usually a sign that the user did not install drivers correctly.

I think the comment meant “if both are set to false”, and I will clarify the language to that effect.