[Xcb] can't figure out how to make an opengl based application

Jeremy Kolb jkolb at brandeis.edu
Fri Sep 22 05:14:12 PDT 2006

Jamey Sharp wrote:
> On Fri, Sep 15, 2006 at 01:49:50AM +0200, JEANNOT David wrote:
>> Hi,
> Hi! Sorry for taking so long to reply.
>> - making my opengl based application "the good XCB way" suppose I must
>> use include/X11/XCB/glx.h & lib/libXCBglx.so instead of
>> include/GL/glx.h & lib/xorg/modules/extensions/libglx.so ? (if yes,
>> the function "glXQueryExtension" does not seem to have a XCB
>> equivalent)

What you want to do is link against a mesa that has been built against
X11/XCB (that's X11 using XCB as a backend).  You'll still need to
include glx.h/gl.h etc.  Then you can make the glx calls using xcb's
glx.  Try XCBGlxQueryVersion for glXQueryExtension.

Once you've set up your visuals etc you can just make OpenGL calls like
you normally would.

> You probably don't want to use GLX directly: you won't get direct
> rendering and you'll have to do a fair bit of work to get the right
> requests issued.
> Jeremy Kolb had a large part of Mesa ported to Xlib/XCB, which would
> allow both Xlib and XCB applications to link against one Mesa library,
> and the XCB apps could run purely native XCB.
>> - I think "xcb glx" cannot run, at this moment, with closed gpu
>> drivers (like NVidious), but is it working with mesa ? if yes, how (->
>> mesa's libGL.so is linked to libX11.so... I'm very confused) ?
> I think you're right: since the proprietary graphics vendors ship
> replacement libGL.so libraries, any improvements we make in the open
> source one (such as the XCB port) will probably take a long time to be
> supported.

Correct, you need to use Mesa compiled with the linux-dri-xcb config
file.  Basically any of the non hardware accelerated rendering calls are
transported through XCB.

There are a few functions like glXChooseVisual that aren't part of the
protocol and so are not implemented in XCB.  A better route to go would
be through configuring FB configs.

>> - finally, is the fact of using the Xlib/XCB interface give the same
>> multithreading advantage that a native XCB port (eg: no need to use
>> XInitThreads, XLockDisplay, XUnlockDisplay) ?
> Sadly, no. Xlib is basically hopeless on that count.
> Hope that helps,
> --Jamey


More information about the Xcb mailing list