glXGetCurrentDisplay returning NULL even with appropriate visual
brian.paul at tungstengraphics.com
Fri Nov 21 16:34:05 PST 2008
tom fogal wrote:
> Hi, I've run into a snag in what seems like glX initialization.
> Through debug versions of client libraries , I think I've
> established why my application is segfaulting in XQueryExtension. The
> display (`dpy' variable) passed is NULL, which seems quite suspect.
> Assuming that is indeed the problem, the root issue appears to be a:
> glXQueryVersion(glXGetCurrentDisplay(), ...);
> line, where glXGetCurrentDisplay returns NULL. Quite strangely, I
> can call glXGetCurrentDisplay manually in the debugger, and it gives
> me what seems to be a valid display; certainly not NULL. My DISPLAY
> seems set correctly; an XOpenDisplay call succeeds; glXChooseVisual
> gives me a pointer instead of NULL. I've thrown a `system("glxinfo");'
> call in various places, and I get the appropriate output (direct
> rendering is enabled, GL extensions are consistent, list of visuals
> seems reasonable).
> Since I'm using GLEW, I wonder if it is related to:
> As a summary, the user is trying to use Chromium with GLEW, and
> dynamically loading glXGetCurrentDisplay via glXGetProcAddress appears
> not to work when Chromium is thrown into the mix. I'm not using
> Chromium, however.
> I have tried GLEW 1.3.4 and GLEW 1.5.1, which give little discernible
> difference. It seems like, in the 1.5.1 case, the Display I get back
> from glXGetCurrentDisplay (when called manually in the debugger) has a
> much larger set of values in the `event_vec' and `wire_vec' fields.
> Attached is the relevant portions of a gdb session. Any ideas what I
> am (or my dependent libraries are...) doing wrong?
I suspect you haven't yet called glXMakeCurrent(). From the man page:
glXGetCurrentDisplay returns the display for the current
context. If no
context is current, NULL is returned.
More information about the xorg