Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator : glXChooseFBConfig always fails when debugging
Forum Updated to NodeBB v4.3 + New Features

QtCreator : glXChooseFBConfig always fails when debugging

Scheduled Pinned Locked Moved Qt Creator and other tools
2 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adi.hodos
    wrote on last edited by
    #1

    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 .

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      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:-)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved