使用PyOpenGl的eglInitialize()中的错误(err = 12296)

问题描述 投票:0回答:1

我正在尝试使用带有EGL的PyOpenGL在装有Mali400 GPU的NanoPi M1 Plus上设置无头渲染。当我运行eglInitalize时,出现以下错误:

错误:

  File "ferb_gpu_1.py", line 22, in <module>
    if not eglInitialize( display, major, minor):
  File "/home/fa/berryconda3/lib/python3.6/site-packages/OpenGL/platform/baseplatform.py", line 402, in __call__
    return self( *args, **named )
  File "/home/fa/berryconda3/lib/python3.6/site-packages/OpenGL/error.py", line 232, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
    err = 12296,
    baseOperation = eglInitialize,
    cArguments = (
        <OpenGL._opaque.EGLDisplay_pointer object at 0xb603f800>,
        c_long(0),
        c_long(0),
    ),
    result = 0
)

这是我编写的代码:

if not os.environ.get( 'PYOPENGL_PLATFORM' ):
    os.environ['PYOPENGL_PLATFORM'] = 'egl'

os.environ['DISPLAY'] = '0.0'

if os.environ.get( 'TEST_NO_ACCELERATE' ):
    OpenGL.USE_ACCELERATE = False

display = eglGetDisplay(EGL_DEFAULT_DISPLAY)
if(display == EGL_NO_DISPLAY):
    print("Failed to get EGL display! Error: %s", eglGetError())
    exit()

major,minor = ctypes.c_long(),ctypes.c_long()
if not eglInitialize( display, major, minor):
    print("Unable to initialize")
    exit()
python opengl pyopengl egl
1个回答
0
投票

问题是,我正在使用os.environ['DISPLAY'] = '0.0',但应该是os.environ['DISPLAY'] = ':0.0'

© www.soinside.com 2019 - 2024. All rights reserved.