在跑
VIBE
时,使用了不带显示器的
Centos
服务器, 在使用
pyrender
进行
offscreen
渲染时报错
OpenGL.error.GLError: GLError(err = 12296,
,具体如下:
Traceback (most recent call last):
File "demo.py", line 416, in <module>
main(args)
File "demo.py", line 278, in main
renderer = Renderer(resolution=(orig_width, orig_height), orig_img=True, wireframe=args.wireframe)
File "***/VIBE/lib/utils/renderer.py", line 60, in __init__
point_size=1.0
File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__
self._create()
File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 134, in _create
self._platform.init_context()
File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/platforms/egl.py", line 177, in init_context
assert eglInitialize(self._egl_display, major, minor)
File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 409, in __call__
return self( *args, **named )
File "***/anaconda3/envs/vibe-env/lib/python3.7/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 0x7f883a03a170>,
c_long(0),
c_long(0),
result = 0
- Ubuntu 可参考 https://pyrender.readthedocs.io/en/latest/install/index.html#installmesa 使用
OSMesa
来进行 offscreen render
。 - 可更方便使用 ·conda· 来安装
OSMesa
,如下:conda install osmesa
注意:安装好 OSMesa
之后,重新安装 PyOpenGL
,否则仍会报错,如下:
pip uninstall pyopengl
git clone https://github.com/mmatl/pyopengl.git
pip install ./pyopengl
在运行脚本之前指定 PYOPENGL_PLATFORM
为 osmesa
即可,如下:
import os
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'
注意: os.environ['PYOPENGL_PLATFORM'] = 'osmesa'
最好紧跟在 import os
后面,确保在使用 render
之前将 PYOPENGL_PLATFORM
更改为 osmesa
,也可以在具体使用 render 之前显式指定 os.environ['PYOPENGL_PLATFORM'] = 'osmesa'
。
错误描述在跑 VIBE 时,使用了不带显示器的 Centos 服务器, 在使用 pyrender 进行 offscreen 渲染时报错 error=12996,具体如下:Traceback (most recent call last): File "demo.py", line 416, in <module> main(args) File "demo.py", line 278, in main renderer = Renderer(resolution=(o