记录一次ubuntu系统下ovito无法调用显卡驱动报错
#报错内容
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QRhiGles2: Failed to create temporary context
QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QRhiGles2: Failed to create context
Failed to create QRhi for QBackingStoreRhiSupport
QOpenGLWidget is not supported on this platform.
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QRhiGles2: Failed to create temporary context
QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QRhiGles2: Failed to create context
Failed to create QRhi for QBackingStoreRhiSupport
QOpenGLWidget is not supported on this platform.
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QRhiGles2: Failed to create temporary context
QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QRhiGles2: Failed to create context
Failed to create QRhi for QBackingStoreRhiSupport
QOpenGLWidget is not supported on this platform.
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QRhiGles2: Failed to create temporary context
QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QRhiGles2: Failed to create context
Failed to create QRhi for QBackingStoreRhiSupport
QOpenGLWidget is not supported on this platform.
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
opengl的集成包括GLX和EGL,报错原因 ovito 默认调用GLX集成,而不是EGL集成。这里ovito与系统的GLX集成不兼容。需要手动改为调用EGL集成
QT_XCB_GL_INTEGRATION=xcb_egl ovito dump.end2.lammpstrj
解决方法1_设置别名:在 shell 配置文件中添加别名:打开环境变量文件,在最后添加
alias ovito='QT_XCB_GL_INTEGRATION=xcb_egl ovito'
QT_XCB_GL_INTEGRATION:Qt环境变量,控制XCB(X11协议C语言绑定)的OpenGL集成方式
xcb_egl:指定使用EGL而不是默认的GLX来管理OpenGL
创建别名是在shell中为常用命令创建快捷方式的简单方法,适合个人使用且不需要系统级权限。
解决方法2——创立运行脚本:在脚本中设定采用EGL集成,然后把脚本的地址添加到环境变量中
新建脚本文件ovito_egl如下:
#!/bin/bash
# 设置使用EGL而不是GLX
export QT_XCB_GL_INTEGRATION=xcb_egl# 启动OVITO
exec /usr/bin/ovito "$@" #这一列写ovito运行文件的位置
将脚本文件的路径添加到环境变量----终端属土ovito_egl可运行ovito
exec
= "变成这个程序,我不再是脚本了"/usr/bin/ovito
= "要变成的程序位置""$@"
= "把所有用户给的参数都传过去"