在opengl 不同context中共享纹理的方法是wgl函数中的wglShareLists(其他非win32平台我不知道);wglShareLists 用法很简单:

        

      BOOL wglShareLists(

          HGLRC hglrc1,     //OpenGL rendering context with which to share
                                    //Display lists
          HGLRC hglrc2,     //OpenGL rendering context to share display lists
     );

只需要传入两个rendering contex handle 即可;

在此之后,所有的glGen...函数将使用同一线性空间分配id:

GLuint glGenLists(
  GLsizei range
);

void glGenTextures(
  GLsizei n,
  GLuint *textures
);

GLAPI void APIENTRY glGenRenderbuffersEXT ( GLsizei n, GLuint * buffers );

GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint * buffers );

这些资源将可以在不同的context中共享。

另外msdn 的remark 段提到:

All rendering contexts of a shared display list must use an identical pixel format. Otherwise the results depend on the implementation of OpenGL used.

所有共享显示列表表的像素格式应该相同,否则将取决于opengl的实现层如何处理这个问题。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-09-09
  • 2022-12-23
  • 2021-08-24
  • 2021-11-28
  • 2021-11-30
猜你喜欢
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案