I have an Window identifier for X11 Window. I didn’t setup this window, I just can get its id (and I suppose, visual id). How can I setup OpenGL context for this window?
In particular, I want to use glXMakeCurrent, but this function receives Display and GLXContext objects. I can create context using glXCreateContext(display, vi, 0, GL_TRUE); but again I need in Display and XVisualInfo objects.
Setting up a OpenGL context on a X11 window is covered by one of my code examples (based upon an example by FTB/fungus), with the notable difference that is uses FBConfig over a regular Visual.
https://github.com/datenwolf/codesamples/blob/master/samples/OpenGL/x11argb_opengl/x11argb_opengl.c
That you’re given only a Window, but not a Display is a problem. You can’t just go around assume the window being on the default display, so whereever you get that Window from, it also must give you the corresponding Display connection as well. Just passing around Window IDs is a failure in API design, when it comes to X11.