Creating a framebuffer-compatible RC

Hello,

I have to create a GL context which can be used to render into a drawable which is already used as framebuffer by another context. In order to be able to call glXMakeCurrent(display, other_drawable, my_context) my own context has to be created with the same visual (or fbconfig) which was used to create the already existing render context.
My problem is that I have no idea how to retrieve the visual/fbconfig (i.e. “pixelformat”) which was used to create the other context.

I tried:

int visualID=0;
int rval=glXQueryContextInfoEXT(m_display, glrc, GLX_VISUAL_ID_EXT, &visualID);

but got stuck, since I don´t know how to retrieve a XVisualInfo* for a visualID. The other thing that looked promising was to use the SGIX_fbconfig extension:

int fbconfigID=0;
int ival=glXQueryContextInfoEXT(m_display, glrc, GLX_FBCONFIG_ID_SGIX, &fbconfigID);

int fbAttribs[4]={GLX_FBCONFIG_ID_SGIX, fbconfigID, 0,0};
int num_formats=0;
GLXFBConfigSGIX *fbconfig=glXChooseFBConfigSGIX(m_display, screen, fbAttribs,  &num_formats);

But this also failes. glXChooseFBConfigSGIX always returns NULL. The retreived fbconfigID is always 0 (which looks suspicious…).

I suspect it to be a driver fault which doesn´t properly handle the special-case-attributes I use.

So, how can my problem be solved? How can I create a new context that can be made current on an existing drawable?
Note: I have no control on when and how the original context gets created, so I can´t track which VisualInfo has been used to create it.

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