Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: glXChooseVisual returns always NULL!

  1. #1
    Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Inside an xbox
    Posts
    290

    glXChooseVisual returns always NULL!

    I am using Red Hat 7.1 ( kernel smp ) with NVidia drivers 29.60. I installed the NVIDIA_GLX-1.0-2960.i386.rpm and NVIDIA_kernel-1.0-2960.rh71smp.i686.rpm.

    This is my current crashed code:


    static int sngBuf[] = { GLX_RGBA,
    GLX_RED_SIZE, 1,
    GLX_GREEN_SIZE, 1,
    GLX_BLUE_SIZE, 1,
    GLX_DEPTH_SIZE, 12,
    None };

    static int dblBuf[] = { GLX_USE_GL,
    GLX_RGBA,
    GLX_RED_SIZE, 1,
    GLX_GREEN_SIZE, 1,
    GLX_BLUE_SIZE, 1,
    GLX_DEPTH_SIZE, 1,
    GLX_DOUBLEBUFFER,
    None };

    static int defBuf[] = { GLX_RGBA, None };
    dpy = XOpenDisplay ( 0 );
    if (0==dpy)
    {
    fatalError("could not open display");
    }

    /* Step 2. Make sure OpenGL's GLX extension is supported. The
    glXQueryExtension also returns the GLX extension's error base and event
    base. For almost all OpenGL programs, this information is irrelevant;
    hence the use of dummy.*/
    if(!glXQueryExtension(dpy, &dummy1, &dummy2))
    {
    fatalError("X server has no OpenGL GLX extension");
    }

    2 /* Step 3. Find an appropriate OpenGL-capable visual. Look for double
    buffering first; if it is not found, settle for a single buffered visual.*/
    vi = glXChooseVisual ( dpy, DefaultScreen(dpy), defBuf/*dblBuf*/);
    if ( 0==vi )
    {
    vi = glXChooseVisual (dpy, DefaultScreen(dpy), sngBuf);
    if ( 0==vi )
    {
    fatalError("no RGB visual with depth buffer");
    }

    doubleBuffer = false;
    }

  2. #2
    Junior Member Newbie
    Join Date
    Apr 2002
    Posts
    9

    Re: glXChooseVisual returns always NULL!

    Hi,

    GLX_RGBA, GLX_USE_GL, and GLX_DOUBLEBUFFER have to be followed by either True or False.

    Andy



    [This message has been edited by andy1 (edited 06-06-2002).]

  3. #3
    Intern Newbie
    Join Date
    Apr 2002
    Posts
    48

    Re: glXChooseVisual returns always NULL!

    No they don't have to be followed by t/f.
    I would suggest running glxinfo if GL may be used etc

    I use this attr flags.
    static int gl_attr[] = {
    GLX_RGBA,
    GLX_DOUBLEBUFFER,
    GLX_RED_SIZE, 1,
    GLX_GREEN_SIZE, 1,
    GLX_BLUE_SIZE, 1,
    GLX_DEPTH_SIZE, 1,
    None
    };

  4. #4
    Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Inside an xbox
    Posts
    290

    Re: glXChooseVisual returns always NULL!

    glxinfo tells me all r,g,b,a bits are 0 and " couldnt find RGB GLX info"... I think i havent the correct XFree86 version ( it should be 4.0.2 ... ). How can I find the current XFree86 version?

  5. #5
    Guest

    Re: glXChooseVisual returns always NULL!

    You could type "rpm -q XFree86" to check the version. More likely is that you missed something else when you installed the nvidia driver. You should have documentation in /usr/share/doc/NVIDIA_GLX-1.0/

    Check that you do not are used a 8 bit 256 color mode.

  6. #6
    Intern Newbie
    Join Date
    Apr 2002
    Posts
    48

    Re: glXChooseVisual returns always NULL!

    To check the X version write at console/terminal X -version ( not --version but -version ).
    You should have loaded glx moadule too ( in XF86 config file in Section "Module" write Load "glx" or somthing like that

  7. #7
    Intern Newbie
    Join Date
    Apr 2002
    Posts
    48

    Re: glXChooseVisual returns always NULL!

    Btw. Instaling just the drivers doesn't doo anything.
    You should configure the X-serevr too

  8. #8
    Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Inside an xbox
    Posts
    290

    Re: glXChooseVisual returns always NULL!

    hehe.... I installed bad the NVidia drivers... I replaced "nv" at Device part by "nvidia" and all problems were solved...

    Thanx to all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •