QGLWidget under new OS configuration throws error

I recently reinstalled my OS from Ubuntu to Fedora 16 and followed the instructions here to get it running on Fedora.

Everything works well. glxinfo looks correct, glxgears runs fine, played games via wine at reasonable speeds. However, I’m trying to get my Qt code to run and it segfaults trying to do certain operations in the paint function like calling begin() on QPainter (which calls glCreateShader) underneath.

I get the following error before my app dies:

QGLTempContext: No GL capable X visuals available

Here’s some of my glxinfo:


    $ glxinfo
    name of display: :0
    display: :0  screen: 0
    direct rendering: Yes
    server glx vendor string: NVIDIA Corporation
    server glx version string: 1.4
    server glx extensions:
        GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
        GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
        GLX_EXT_swap_control, GLX_EXT_texture_from_pixmap, GLX_ARB_create_context,
        GLX_ARB_create_context_profile, GLX_EXT_create_context_es2_profile,
        GLX_ARB_create_context_robustness, GLX_ARB_multisample,
        GLX_NV_float_buffer, GLX_ARB_fbconfig_float, GLX_EXT_framebuffer_sRGB
    client glx vendor string: NVIDIA Corporation
    client glx version string: 1.4
    client glx extensions:
        GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info,
            GLX_EXT_visual_rating, GLX_EXT_import_context, GLX_SGI_video_sync,
        GLX_NV_swap_group, GLX_NV_video_out, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
        GLX_SGI_swap_control, GLX_EXT_swap_control, GLX_ARB_create_context,
        GLX_ARB_create_context_profile, GLX_NV_float_buffer,
        GLX_ARB_fbconfig_float, GLX_EXT_fbconfig_packed_float,
        GLX_EXT_texture_from_pixmap, GLX_EXT_framebuffer_sRGB,
        GLX_NV_present_video, GLX_NV_copy_image, GLX_NV_multisample_coverage,
        GLX_NV_video_capture, GLX_EXT_create_context_es2_profile,
        GLX_ARB_create_context_robustness
    GLX version: 1.4
    GLX extensions:
        GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
        GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
        GLX_EXT_swap_control, GLX_EXT_texture_from_pixmap, GLX_ARB_create_context,
        GLX_ARB_create_context_profile, GLX_EXT_create_context_es2_profile,
        GLX_ARB_create_context_robustness, GLX_ARB_multisample,
        GLX_NV_float_buffer, GLX_ARB_fbconfig_float, GLX_EXT_framebuffer_sRGB,
        GLX_ARB_get_proc_address
    OpenGL vendor string: NVIDIA Corporation
    OpenGL renderer string: GeForce 8800 GTS/PCI/SSE2
    OpenGL version string: 3.3.0 NVIDIA 290.10
    OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
    ...

I’ve downloaded OpenGL test code around the web that use shaders and new functionality without issue, so from what I can tell Qt is asking for something different than other programs.

Excerpt from qgl_x11.cpp:


int attribs[] = {GLX_RGBA, XNone};
    XVisualInfo *vi = glXChooseVisual(X11->display, screen, attribs);
    if (!vi) {
        qWarning("QGLTempContext: No GL capable X visuals available.");
        return;
    }

My code was running fine on Ubuntu. Looking around on the internet, there seems like someone was having a similar issue with glXChooseVisual, a function Qt calls underneath, which may be where this error is coming from. Supposedly they had to install the glx module or something, but I’m not sure if that’s my particular problem.

My xorg.conf is only four lines and only mentions the nvidia driver and not anything regarding a glx module. Do I need to add that module explicitly to my xorg.conf?


Section "Device"
    Identifier      "Screen0"
    Driver          "nvidia"
EndSection

I managed to figure out the problem. I noticed it was only happening when launching from inside Qt Creator. Looking at the run settings to compare them to my shell (where the executable works), I noticed the only difference was that LD_LIBRARY_PATH was set. By unsetting it in Qt Creator, the error went away. Likewise, if I set that variable in the shell, I’d reproduce the crash.

export LD_LIBRARY_PATH=/usr/lib64/qt4

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.