How to attach default depth buffer to FBO? How to use depth renderbuffer buffer attached to FBO (after drawing to it) as a default depth buffer?
Basically I want to use the same depth buffer for both the FBO and backbuffer rendering.
This is by design. OpenGL (and older versions of DirectX) were designed back in the days when windowed apps literally shared the same frame buffer. That meant that if you had two overlapped windows, the windows would be trying to use the exact same pixels from the color, depth, and stencil buffers. The windowing systems dealt with this via a hard-coded masking operation.
In other words, you do not own the default depth buffer, cannot change the default depth buffer, and cannot reliably read from the default depth buffer in the OpenGL API.
Your best bet is to just do all of your rendering in an FBO and then use a texture blit to get the final image into the default FBO.