QtCreator : glXChooseFBConfig always fails when debugging



  • I've got this piece of code that tries to get an XVisualInfo via glx :
    @
    #include <cstdio>
    #include <cstdlib>
    #include <iostream>
    #include <memory>
    #include <X11/Xlib.h>
    #include <X11/Xutil.h>
    #include <GL/gl.h>
    #include <GL/glext.h>
    #include <GL/glx.h>

    using namespace std;

    struct x11_display_deleter {
    void operator()(Display* displ) const noexcept {
    if (displ)
    XCloseDisplay(displ);
    }
    };

    struct x11_mem_deleter {
    void operator()(void* mem) const noexcept {
    if (mem)
    XFree(mem);
    }
    };

    int main() {
    unique_ptr<Display, x11_display_deleter> display(XOpenDisplay(nullptr));
    if (!display) {
    fprintf(stderr, "Failed to open display");
    return -1;
    }

    int glx_ver_min;
    int glx_ver_maj;
    if (!glXQueryVersion(display.get(), &glx_ver_maj, &glx_ver_min))
        return -1;
    
    if (glx_ver_maj < 1)
        return -1;
    
    if (glx_ver_min < 3)
        return -1;
    
    int C_visual_attribs[] = {
        GLX_DOUBLEBUFFER, True,
        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_RENDER_TYPE, GLX_RGBA_BIT,
        GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
        GLX_X_RENDERABLE, True,
        GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
        None
    };
    
    int num_cfgs_found;
    unique_ptr<GLXFBConfig, x11_mem_deleter> fbconfigs(
                glXChooseFBConfig(display.get(), DefaultScreen(display.get()),
                                  C_visual_attribs, &num_cfgs_found));
    if (!fbconfigs) {
        fprintf(stderr, "No configs for specified attributes!");
        return -1;
    }
    
    GLXFBConfig default_cfg = fbconfigs.get()[0];
    unique_ptr<XVisualInfo, x11_mem_deleter> glx_visual(
                glXGetVisualFromFBConfig(display.get(), default_cfg));
    
    if (glx_visual) {
        printf("\nGot a visual!");
    }
    return 0;
    

    }
    @
    When this code is debugged from QtCreator, the call to glXChooseFBConfig always fails. When debugging from gdb/ddd or running the executable, the call succeeds, as it should. I have also tried debugging with Eclipse CDT and NetBeans. Both scenarios work, so the problem is specific to QtCreator. Any help is appreciated (I don't want to go back to Eclipse, and manual debugging with gdb is a little inconvenient). I'm using Fedora 17 X64, QtCreator 2.5.2/2.6.0 beta, g++-4.7.2 .


  • Moderators

    Sounds interesting:-)

    Could you please "file this as a bug":http://bugreports.qt-project.org/ ? Knowing the person working on the debugger I doubt that they will notice a posting in a forum:-)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.