NVIDIA / libglvnd

The GL Vendor-Neutral Dispatch library
496 stars 92 forks source link

Error initializing egl inside docker container based on libglvnd #174

Closed mmmikael closed 5 years ago

mmmikael commented 5 years ago

I’m getting this error when calling eglInitialize in a cudagl docker container:

Traceback (most recent call last):
  File "egl_context.py", line 12, in <module>
    egl.eglInitialize(egl_display, pointer(major), pointer(minor))
  File "/usr/local/lib/python3.6/dist-packages/PyOpenGL-3.1.3b2-py3.6.egg/OpenGL/platform/baseplatform.py", line 409, in __call__
    return self( *args, **named )
  File "/usr/local/lib/python3.6/dist-packages/PyOpenGL-3.1.3b2-py3.6.egg/OpenGL/error.py", line 232, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
    err = 12289,
    baseOperation = eglInitialize,
    cArguments = (
        <OpenGL._opaque.EGLDisplay_pointer object at 0x7fef5cc2ae18>,
        <OpenGL.arrays.arraydatatype.LP_c_int object at 0x7fef59c22ea0>,
        <OpenGL.arrays.arraydatatype.LP_c_int object at 0x7fef59c22f28>,
    ),
    result = 0
)

Any idea why this is happening?

I’m initializing egl this way:

import os
from ctypes import pointer

os.environ["PYOPENGL_PLATFORM"] = "egl"

import OpenGL.GL as gl
import OpenGL.EGL as egl

egl_display = egl.eglGetDisplay(egl.EGL_DEFAULT_DISPLAY)
major, minor = egl.EGLint(), egl.EGLint()
egl.eglInitialize(egl_display, pointer(major), pointer(minor))
kbrenneman commented 5 years ago

That doesn't give me much to work with, but I can at least offer some suggestions for narrowing down the problem.

First, are you getting a non-NULL handle from eglGetDisplay? Second, what EGL error are you getting?

Also, try setting up a debug callback function with EGL_KHR_debug before you call any other EGL functions. That can give you a more detailed description of whatever error you're running into. Writing your test program in C might make that easier, and would help rule out any problems related to PyOpenGL.

mmmikael commented 5 years ago

The problem was simply that graphics was missing from the environment variable NVIDIA_DRIVER_CAPABILITIES.

v-wewei commented 4 years ago

hi, @mmmikael i meet the same problem , how did you solve the problem, i just do not catch the meaning "The problem was simply that graphics was missing from the environment variable NVIDIA_DRIVER_CAPABILITIES", does this means to export NVIDIA_DRIVER_CAPABILITIES=graphics ? but, it did not work . And i am not in a docker ! Thanks advance !

azuryl commented 2 years ago

The problem was simply that graphics was missing from the environment variable NVIDIA_DRIVER_CAPABILITIES.

@mmmikael it did not work too in ubuntu18.04