My aim is to share resources (texture) between WebGL (in browser, canvas.getContext()) and glX extention (glXCreateContext [1]) for c++ (arch linux) in order to share a texture between WebGL and X.
i.e. load a window from X (using the backing pixmap) into a WebGL texture, without using the XGetImage/XGetSubImage/XShmGetImage/XShmGetSubImage to directly access the backing pixmap.
- Can that be done at all, considering that WebGL is OpenGL ES 2.0?
- If so, how do I get the handle for the context?
- Can I make the WebGL context the current context, and then use glXGetCurrentContext?
- Is there any other way to share texture between WebGL and c++ glX?
To further clarify, the idea is, CreateContext(webgl) in browser -> Share handle with C++ app -> Create new glXContext in c++ -> share texture between them.
Finally, since I am new to OpenGL in general, I keep wondering, is the texture object shared between all OpenGL/OpenGL ES/WebGL Contexts? Can it be if we knew how to bind it?
[1] glX Create context function, note the share list.
GLXContext glXCreateContext( Display * dpy,
XVisualInfo * vis,
GLXContext shareList,
Bool direct);