Headless using EGL, but with CMake ... no shadows

Hi everyone,

my goal is to run my application using EGL on a ubuntu 20.04 headless server.
looking at issues like Headless Nvidia · Issue #557 · panda3d/panda3d · GitHub and Try to build panda3d using on a headless machine (no x-11) using egl this seems possible, but all issues are related to python users.

In my case I have a c++ application and I compile Panda via CMake (to import it via find_package), but it seems there is no cmake target for p3headlessgl library.
I’m building Panda using commit adb92428856853019583f398d27c5d34e44a9343 (14 May 2024)

I modified the cmake to generate a metalib using p3egldisplay_gles1 and using NO_X11 which kind of works. The app runs correctly without opening the window and grabbing the screenshots I see the rendering is (mostly) ok, but there are no shadows and also custom shaders seems not to be loaded even though the lib does links to Cg.

ldd pandagl.so
linux-vdso.so.1 (0x00007fffdc3ee000)
libGLESv1_CM.so.1 => /lib/x86_64-linux-gnu/libGLESv1_CM.so.1 (0x00007fb2c8204000)
libpanda.so.1.11 => /localhome/work/07_cv3/workspace/build/debug/Panda3D/lib/libpanda.so.1.11 (0x00007fb2c77fc000)
libpandaexpress.so.1.11 => /localhome/work/07_cv3/workspace/build/debug/Panda3D/lib/libpandaexpress.so.1.11 (0x00007fb2c76c1000)
libp3prc.so.1.11 => /localhome/work/07_cv3/workspace/build/debug/Panda3D/lib/libp3prc.so.1.11 (0x00007fb2c7692000)
libp3dtool.so.1.11 => /localhome/work/07_cv3/workspace/build/debug/Panda3D/lib/libp3dtool.so.1.11 (0x00007fb2c7648000)
libEGL.so.1 => /lib/x86_64-linux-gnu/libEGL.so.1 (0x00007fb2c7631000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fb2c744f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb2c742c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb2c723a000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb2c82b5000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007fb2c7182000)
libCg.so => /lib/x86_64-linux-gnu/libCg.so (0x00007fb2c5ca9000)
libfftw3.so.3 => /lib/x86_64-linux-gnu/libfftw3.so.3 (0x00007fb2c5aa1000)
libvorbisfile.so.3 => /lib/x86_64-linux-gnu/libvorbisfile.so.3 (0x00007fb2c5a96000)
libjpeg.so.8 => /lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007fb2c5a11000)
libtiff.so.5 => /lib/x86_64-linux-gnu/libtiff.so.5 (0x00007fb2c598f000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007fb2c5957000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fb2c593b000)
libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007fb2c5835000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fb2c5776000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb2c5627000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb2c560c000)
libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fb2c5579000)
libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fb2c52a2000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb2c529a000)
libvorbis.so.0 => /lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007fb2c526c000)
libogg.so.0 => /lib/x86_64-linux-gnu/libogg.so.0 (0x00007fb2c525f000)
libwebp.so.6 => /lib/x86_64-linux-gnu/libwebp.so.6 (0x00007fb2c51f5000)
libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007fb2c514c000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fb2c5121000)
libjbig.so.0 => /lib/x86_64-linux-gnu/libjbig.so.0 (0x00007fb2c5110000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fb2c4fe6000)
libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007fb2c4fb9000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fb2c4f46000)

Is it a limit of this configuration or am I missing something?

Thanks

I do not believe that Cg works with GLES. Also, if I recall correctly, the auto-shader is pretty limited (or maybe just unsupported) by GLES. You can try GLES2 instead of GLES1 if you absolutely need to use OpenGL ES, but I’d recommend using desktop OpenGL (no ES) if you can.

Thanks @Moguri for your reply. I’d be happy to use OpenGL (no ES), my only limit is the application have to run in a headless environment (no X11)

I know that using the makepanda.py to comile Panda3D, a library called p3headlessgl is produced for this purpose.

My goal is to generate the same library by using CMake. Right now there is no CMake target for it and I was trying to create one, but failing.

I’m looking for advices about how to ‘port’ this feature from makepanda to CMake

I think I made it, after some trials and error.
I’ll cleanup the CMake code and post it here in case some one else need it.