在两个 opengl 上下文之间共享纹理

Sharing Texture between two opengl contexts

我使用 GLFW3 创建了一个 window。我使用另一个带 GLX 的线程创建了一个 child window。在 GLX opengl 上下文创建期间,我将主 windows opengl 上下文(由 glXGetCurrentContext 实现)作为 sharelist 参数传递给 child [=25= 的 opengl 上下文],因为我想在主 window 中使用由 child 上下文渲染的纹理。但我收到此错误:

X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Serial number of failed request:  38
  Current serial number in output stream:  39

正如我在 glxCreateContext 文档中看到的那样,

BadMatch is generated if the context to be created would not share the address space or the screen of the context specified by shareList.

那么,这是否意味着我无法与此上下文共享纹理?

所以,我才注意到问题出在哪里。由于其中一个 GL 上下文在一个 GPU 上,另一个在另一个 GPU 上,因此我似乎无法彼此共享显示对象。所以,我必须使用 glXCopyImageSubDataNV 将纹理从一个 gpu 复制到另一个 gpu。