View Full Version : glxShareLists two separate displays, same card

Stephen Webb
03-12-2008, 06:15 PM
I'm trying to share lists between two contexts. I have seen some references to glxShareLists, but I haven't found any examples and I haven't found it in my openGL headers.

I have found this, however:

GLXContext glXCreateContext( Display *dpy,
XVisualInfo *vis,
GLXContext shareList,
Bool direct )

Is this the correct / only way to share lists between two contexts?

I have been able to make this work when the two contexts live on the same display (e.g. both on :0.1) but when they live on two different displays (e.g. :0.0 and :0.1) sharing doesn't seem to work. The second glXCreateContext call fails:

Error: glXCreateContext failed.
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 143 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Serial number of failed request: 24
Current serial number in output stream: 1220

Note that both displays are on the same physical graphics card.

It seems like I should be able to do this (I sure want to) -- both contexts are on the same card, created in the same process, etc. Am I out of luck? Does anyone have any suggestions?



09-11-2008, 11:07 PM
I think it's because the CreateContext and all opengl calls go through GLX, and they need a Display* connection. And you can't share contexts with different displays. (it would be like sharing Displays with different processes.) My suggestion is to use twinview or something and use the same Display *.

I always had a bit of confusion with threading and opengl. Do you need to LockDisplay when you MakeCurrentContext? If so, what's the point of multiple contexts?