解决robosuite设置has_offscreen_renderer=True时报错ERROR: GLEW initalization error: Missing GL version

本文介绍了一个关于使用Robosuite建立RL环境时遇到的问题:设置has_offscreen_renderer=True时报错。问题源于mujoco-py自带的OpenGL与自行安装的高版本OpenGL之间的冲突。文中提供了解决方案,通过在robosuite源码中加入特定代码来确保使用mujoco-py自带的OpenGL。

问题描述

使用robosuite建立RL环境,设置has_renderer=True时可以正常运行,而设置has_offscreen_renderer=True时报错如题。
该问题好像是因为mujoco-py会自带openGL,而我自己又在nvidia显卡驱动里安装了openGL,当使用可视化绘图(has_renderer=True)时,会使用mujoco-py自带的openGL,当不进行显示时(has_offscreen_renderer=True),会使用自己安装的openGL,自己装的openGL版本太高就会报错ERROR: GLEW initalization error: Missing GL version。(从网上的资料看好像是这样)
所以解决办法是在使用has_offscreen_renderer=True时,使用mujoco-py自带的openGL,如下:

解决办法

在安装的robosuite库的/home/name/anaconda3/envs/env_name/lib/python3.7/site-packages/robosuite/environments/base.py的第310左右修改代码,如下:

elif self.has_offscreen_renderer:
    if self.sim._render_context_offscreen is
In /build/vtk7-yd0MKW/vtk7-7.1.1+dfsg2/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 636 vtkXOpenGLRenderWindow (0x7fac4c000cb0): GL version 2.1 with the gpu_shader4 extension is not supported by your graphics driver but is required for the new OpenGL rendering backend. Please update your OpenGL driver. If you are using Mesa please make sure you have version 10.6.5 or later and make sure your driver in Mesa supports OpenGL 3.2. ERROR: In /build/vtk7-yd0MKW/vtk7-7.1.1+dfsg2/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx, line 3535 vtkOpenGLPolyDataMapper (0x7fac4c59be50): failed after BuildBufferObjects 1 OpenGL errors detected 0 : (1280) Invalid enum ERROR: In /build/vtk7-yd0MKW/vtk7-7.1.1+dfsg2/Rendering/OpenGL2/vtkShaderProgram.cxx, line 394 vtkShaderProgram (0x7fac4c5e5e50): 1: #version 120 2: #ifdef GL_ES 3: #if __VERSION__ == 300 4: #define varying in 5: #ifdef GL_FRAGMENT_PRECISION_HIGH 6: precision highp float; 7: precision highp sampler2D; 8: precision highp sampler3D; 9: #else 10: precision mediump float; 11: precision mediump sampler2D; 12: precision mediump sampler3D; 13: #endif 14: #define texelFetchBuffer texelFetch 15: #define texture1D texture 16: #define texture2D texture 17: #define texture3D texture 18: #endif // 300 19: #if __VERSION__ == 100 20: #extension GL_OES_standard_derivatives : enable 21: #ifdef GL_FRAGMENT_PRECISION_HIGH 22: precision highp float; 23: #else 24: precision mediump float; 25: #endif 26: #endif // 100 27: #else // GL_ES 28: #define highp 29: #define mediump 30: #define lowp 31: #if __VERSION__ == 150 32: #define varying in 33: #define texelFetchBuffer texelFetch 34: #define texture1D texture 35: #define texture2D texture 36: #define texture3D texture 37: #endif 38: #if __VERSION__ == 120 39: #extension GL_EXT_gpu_shader4 : require 40: #endif 41: #endif // GL_ES 42: 43: 44: /*========================================================================= 45: 46: Program: Visualization Toolkit 47: Module: vtkPoly
03-29
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值