[Python] eglInitialize failed with EGL_NOT_INITIALIZED

Discussão em 'Python' iniciado por Stack, Julho 7, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to run a 3D human model generator, where EGL is used. When I run the following code:

    import OpenGL.EGL as egl
    from ctypes import pointer

    egl_display = egl.eglGetDisplay(egl.EGL_DEFAULT_DISPLAY)
    print(egl_display)

    major, minor = egl.EGLint(), egl.EGLint()
    print(major, minor)

    egl.eglInitialize(egl_display, pointer(major), pointer(minor))


    the output of the above code is as follows:

    #################### the first two print info ####################
    <OpenGL._opaque.EGLDisplay_pointer object at 0x7f480e971940>
    c_int(0) c_int(0)

    #################### error ####################
    Traceback (most recent call last):
    File "main.py", line 10, in <module>
    egl.eglInitialize(egl_display, pointer(major), pointer(minor))
    File "/data_HDD/zhuxingyu/anaconda3/envs/icon/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 415, in __call__
    return self( *args, **named )
    File "src/errorchecker.pyx", line 58, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError
    OpenGL.raw.EGL._errors.EGLError: EGLError(
    err = EGL_NOT_INITIALIZED,
    baseOperation = eglInitialize,
    cArguments = (
    <OpenGL._opaque.EGLDisplay_pointer object at 0x7f480e971940>,
    <OpenGL.raw.EGL._types.LP_c_int object at 0x7f480e971ac0>,
    <OpenGL.raw.EGL._types.LP_c_int object at 0x7f480e971b40>,
    ),
    result = 0
    )


    I'm unfamiliar to EGL and really confused about this error, and here's the information of my machine:

    • 5 NVIDIA GeForce GPU with CUDA 11.4 and Driver version 470.82.00 (get it from nvidia-smi)
    • have libegl1 installed and have the following *.so files under /usr/lib/x86_64-linux-gnu/

    /usr/lib/x86_64-linux-gnu/libEGL_mesa.so.0
    /usr/lib/x86_64-linux-gnu/libEGL_mesa.so.0.0.0
    /usr/lib/x86_64-linux-gnu/libEGL_nvidia.so.0
    /usr/lib/x86_64-linux-gnu/libEGL_nvidia.so.470.82.00
    /usr/lib/x86_64-linux-gnu/libEGL.so
    /usr/lib/x86_64-linux-gnu/libEGL.so.1
    /usr/lib/x86_64-linux-gnu/libEGL.so.1.0.0

    • I'm running the code using vscode remote-ssh, i.e. I'm working on machine A, while the code is actually running on machine B. All the machine information above is about machine B.

    What else do I need to make eglInitialize run normally?

    Continue reading...

Compartilhe esta Página