depth buffer sharing with pbuffer

I’m using a pbuffer and I would like to share zbuffer between my two contexts (original and pbuffer) to use it for depth of field computing :

-active pbuffer
-draw scene
-inactive pbuffer (orginal context)
-get pbuffer’s color buffer in a texture
-draw new scene with pbuffer’s depth buffer

I’ve found the constant WGL_SHARE_DEPTH_ARB for pixel format in pbuffer but when i use it my screen is dark and i don’t know why.


Try reading the Pbuffers depth buffer and write these pixel values into framebuffer:

glReadPixels(x, y, width, height, GL_DEPTH_COMPONENT,...) 
glWritePixels(width, height, GL_DEPTH_COMPONENT,...) 

This should work, but I have no experience with performance.


thanks but this method is too slow. I’m searching a way to specify that i use the same zbuffers in the two contexts