Code working with pandagl but not p3tinydisplay

You can render headless with the accelerated NVIDIA drivers in OpenGL mode, which is what I would recommend - it would give you best performance and gives you access to the widest range of supported features. I happen to have researched this in the past, so I’ve dug up my old notes. You would need to run an X11 server but with no display attached, but some trickery is needed in your Xorg configuration to make this work.

Here is the xorg.conf I used in the past to accomplish this.

Section "ServerLayout"
    Identifier "Layout0"
    Screen 0 "Screen0"
    Option "AutoAddDevices" "false"
EndSection

Section "Monitor"
    Identifier "Monitor0"
    VendorName "Unknown"
    ModelName "Unknown"
    HorizSync 28.0 - 33.0
    VertRefresh 43.0 - 72.0
    Option "DPMS"
EndSection

Section "Device"
    Identifier "Device0"
    Driver "nvidia"
    VendorName "NVIDIA Corporation"
    Option "NoLogo" "true"
    Option "UseEDID" "false"
    Option "ConnectedMonitor" "DFP"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "Device0"
    Monitor "Monitor0"
    DefaultDepth 24
    SubSection "Display"
        Depth 24
    EndSubSection
EndSection

This basically tricks the NVIDIA driver by disabling the mechanism by which it checks whether a display is connected to the output connector.

To run a program from externally (eg. an ssh shell) you would have to set DISPLAY environment variable to :0.0, eg.

DISPLAY=:0.0 python test.py
1 Like