mcfletch/pyopengl

Problem: Headless rendering with nvidia and using libOpenGL.so

tasptz opened this issue · 1 comments

How can I make pyopengl use libOpenGL.so and not libGL.so.
For detailed explanation see Pro Tip: Linking OpenGL for Server-Side Rendering.

To use glX and OpenGL today, you should link against libOpenGL.so as well as libGLX.so. The first contains the OpenGL symbols, the latter the GLX symbols. If you want to use EGL context management instead, link against libOpenGL.so and libEGL.so.

I used lsof -p <pid> and for sure the python process loaded libGL.so and thus the EGL-OpenGL context was not working.

diff --git a/OpenGL/platform/egl.py b/OpenGL/platform/egl.py
index 8a92d018..d52f9157 100644
--- a/OpenGL/platform/egl.py
+++ b/OpenGL/platform/egl.py
@@ -33,7 +33,7 @@ class EGLPlatform( baseplatform.BasePlatform ):
         try:
             return ctypesloader.loadLibrary(
                 ctypes.cdll,
-                'GL', 
+                'OpenGL',
                 mode=ctypes.RTLD_GLOBAL 
             )
         except OSError:```

This seems to resolve the problem, but is probably not a universal solution.