OpenGL - Share existing textures with future contexts?

前端 未结 1 372
感情败类
感情败类 2021-01-15 00:29

I have an application where I draw frames to a texture using the FBO extensions.

These frames are then be displayed to different windows that are opened whil

1条回答
  •  孤城傲影
    2021-01-15 01:08

    Sharing Lists between OpenGL contexts will share all data encapsulating buffer objects as well (textures, vertex buffer objects, pixel buffer objects) but not abstract collection objects (framebuffer objects, vertex array objects). It is mandatory to create the sharing, before creating any new named objects in the new context, as creating names before the sharing may result in namespace collisions. Already created objects are shared. But this of course requires precautions, because what would happen if both context A and B had textures with ID=1? If however A had a lot of textures and B none, then the texture names of A can be transferred to B just fine. That's the caveat.

    However if you just want to render to multiple windows: It is perfectly possible to use a single OpenGL context on an arbitrary number of windows, as long as their PIXELFORMATDESCRIPTOR is compatible. That's what the HDC parameter of wglMakeCurrent is meant for. If a context was strictly bound to a single window, wglMakeCurrent had only a HRC parameter.

    0 讨论(0)
提交回复
热议问题