I can trivially get visuals, visual IDs, etc. when generating an OpenGL context using xlib, but OpenXR requires a GLXFBConfig in order to work. But I can't figure out how to get the GLXFBConfig for the currently active visual. Any ideas?
glXGetVisualFromFBConfig seems to do the opposite, in that it gets me a visual from an GLXFBConfig. But my code reliably finds the correct visual this way. Is there a way to go the other way?
int attribs[] = { GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
None };
XVisualInfo * vis = glXChooseVisual(CNFGDisplay, screen, attribs);
CNFGVisual = vis->visual;
CNFGVisualID = vis->visualid;
CNFGWinAtt.depth = vis->depth;
CNFGCtx = glXCreateContext( CNFGDisplay, vis, NULL, True );
I think @genpfault's solution would work, but I decided, instead to just use the
glXChooseFBConfigapproach instead, so that it just matches since it turns out it's not that hard to actually choose what I want.