2023年解决Pangolin X11: Invalid GLX version. Require GLX >= 1.3 Unable to retrieve framebuffer options

我是使用X2GO远程登陆的服务器。
在运行ORB-SLAM3的过程中出现了Pangolin 相关报错。
是以下两条

Pangolin X11: Invalid GLX version. Require GLX >= 1.3
Pangolin X11: Unable to retrieve framebuffer options

搜到的比较多的解决方法是
Pangolin/src/display/device下的display_x11.cpp代码修改

		GLX_DOUBLEBUFFER    , glx_doublebuffer ? True : False,
        GLX_SAMPLE_BUFFERS  , glx_sample_buffers,
        GLX_SAMPLES         , glx_sample_buffers > 0 ? glx_samples : 0,

改为

		GLX_DOUBLEBUFFER    , glx_doublebuffer ? True : False,
        //GLX_SAMPLE_BUFFERS  , glx_sample_buffers,
        //GLX_SAMPLES         , glx_sample_buffers > 0 ? glx_samples : 0,

或者改为

		GLX_DOUBLEBUFFER    , glx_doublebuffer ? False: False,
        //GLX_SAMPLE_BUFFERS  , glx_sample_buffers,
        //GLX_SAMPLES         , glx_sample_buffers > 0 ? glx_samples : 0,

完了之后重新编译安装Pangolin

make -j8
sudo make install

我试了,没起作用
搜到另外两篇解决方案
踩坑 X11 图形界面显示问题
代码仓issue,Pangolin X11: Unable to retrieve framebuffer options #260
里面的zoldaten在 Nov 15, 2022回复说

nano ~/Pangolin/components/pango_windowing/src/display_x11.cpp
correct as in https://woojjang.tistory.com/52 pointed out (right spelling below):
GLXFBConfig* fbc = glXGetFBConfigs(display, DefaultScreen(display), &fbcount);
and
//throw std::runtime_error("Pangolin X11: Invalid GLX version. Require GLX >= 1.3");

no need GLX_SAMPLE_BUFFERS change.

也就是

throw std::runtime_error("Pangolin X11: Invalid GLX version. Require GLX >= 1.3");
改为
//throw std::runtime_error("Pangolin X11: Invalid GLX version. Require GLX >= 1.3");

 GLXFBConfig* fbc = glXChooseFBConfig(display, DefaultScreen(display), visual_attribs, &fbcount);
改为
  GLXFBConfig* fbc = glXGetFBConfigs(display, DefaultScreen(display), &fbcount);
 

这是我修改完的代码

 // Desired attributes
    static int visual_attribs[] =
    {
        GLX_X_RENDERABLE    , True,
        GLX_DRAWABLE_TYPE   , GLX_WINDOW_BIT,
        GLX_RENDER_TYPE     , GLX_RGBA_BIT,
        GLX_X_VISUAL_TYPE   , GLX_TRUE_COLOR,
        GLX_RED_SIZE        , 8,
        GLX_GREEN_SIZE      , 8,
        GLX_BLUE_SIZE       , 8,
        GLX_ALPHA_SIZE      , 8,
        GLX_DEPTH_SIZE      , 24,
        GLX_STENCIL_SIZE    , 8,
        GLX_DOUBLEBUFFER    , glx_doublebuffer ? True : False,
        GLX_SAMPLE_BUFFERS  , glx_sample_buffers,
        GLX_SAMPLES         , glx_sample_buffers > 0 ? glx_samples : 0,
        None
    };


    int glx_major, glx_minor;
    if ( !glXQueryVersion( display, &glx_major, &glx_minor ) ||
         ( ( glx_major == 1 ) && ( glx_minor < 3 ) ) || ( glx_major < 1 ) )
    {
        // FBConfigs were added in GLX version 1.3.
        //throw std::runtime_error("Pangolin X11: Invalid GLX version. Require GLX >= 1.3");
    }

    int fbcount;
    GLXFBConfig* fbc = glXGetFBConfigs(display, DefaultScreen(display), &fbcount);
    //GLXFBConfig* fbc = glXChooseFBConfig(display, DefaultScreen(display), visual_attribs, &fbcount);
    if (!fbc) {
        throw std::runtime_error("Pangolin X11: Unable to retrieve framebuffer options");
    }

完了之后重新编译安装Pangolin,重新编译一下ORB-SLAM3,好用了

你可能感兴趣的:(SLAM,slam,ubuntu,linux)