<blockquote>
  <p>Is it possible to bind default framebuffer's depth buffer to another framebuffer?</p>
</blockquote>

<p>First, you "attach" images to framebuffers. You "bind" objects to the context; you "attach" objects to other objects.</p>

<p>Second, no, you cannot attach images of the default framebuffer to anything.</p>

<blockquote>
  <p>If not, how can I copy default depth to another depth buff, or what is best way to do this?</p>
</blockquote>

<p>You render to your own depth buffer entirely. Just copy/render the image data out to the default framebuffer when its time to display it.</p>

CC BY-SA 3.0
2018-02-07T18:03:14.550Z
what about `glBlitFramebuffer`? Can't I copy default framebuffer's images or depth to another framebuffer with it?
recp
CC BY-SA 3.0
2018-02-07T20:15:28.880Z
@recp: Yes, you could. Or you could just render to your own image and *not* have to do a copy. Why pick the slower option?
Nicol Bolas
CC BY-SA 3.0
2018-02-07T20:18:20.410Z
"Why pick the slower option?" maybe this is what I was looking for. I don't know which one is faster so I tried to save texture space. As a solution I will render opaque objects to another framebuff and share its depth buffer with transparency framebuff, this seems better way and fits with your answer I guess
recp
CC BY-SA 3.0
2018-02-07T17:47:30.067Z
2018-02-07T17:47:30.067Z
Nicol Bolas
<p>I'm trying to implement <a href="http://casual-effects.blogspot.com.tr/2015/03/implemented-weighted-blended-order.html" rel="nofollow noreferrer">Weighted, Blended Order-Independent Transparency</a></p>

<p>There are three passes:</p>

<ol>
<li>3D opaque surfaces to a primary framebuffer</li>
<li>3D transparency accumulation to an off-screen framebuffer</li>
<li>2D compositing transparency over the primary framebuffer</li>
</ol>

<p>I need to test transparent objects against default depth buffer. I created a framebuff for transparency pass and also created a depth buffer for maybe I can copy default depth to this buffer if this is the only way. But I don't know how to do that because I created depth buffer with <code>GL_DEPTH_COMPONENT24</code> but I don't know default depth format.</p>

<p>Is it possible to bind default framebuffer's depth buffer to another framebuffer? If not, how can I copy default depth to another depth buff, or what is best way to do this?</p>

<opengl><transparency><frame-buffer>
using default depth buffer in off-screen framebuffer
recp
# using default depth buffer in off-screen framebuffer

(Asked by: username_0 on 2018-02-07)

I'm trying to implement [Weighted, Blended Order-Independent Transparency](http://casual-effects.blogspot.com.tr/2015/03/implemented-weighted-blended-order.html)

There are three passes:

1. 3D opaque surfaces to a primary framebuffer
2. 3D transparency accumulation to an off-screen framebuffer
3. 2D compositing transparency over the primary framebuffer

I need to test transparent objects against default depth buffer. I created a framebuff for transparency pass and also created a depth buffer for maybe I can copy default depth to this buffer if this is the only way. But I don't know how to do that because I created depth buffer with `GL_DEPTH_COMPONENT24` but I don't know default depth format.

Is it possible to bind default framebuffer's depth buffer to another framebuffer? If not, how can I copy default depth to another depth buff, or what is best way to do this?

**Tags:** opengl, transparency, frame-buffer


---

## 1 answers

### Answer by username_1 on 2018-02-07. Score: 3 | Accepted answer

> Is it possible to bind default framebuffer's depth buffer to another framebuffer?

First, you "attach" images to framebuffers. You "bind" objects to the context; you "attach" objects to other objects.

Second, no, you cannot attach images of the default framebuffer to anything.

> If not, how can I copy default depth to another depth buff, or what is best way to do this?

You render to your own depth buffer entirely. Just copy/render the image data out to the default framebuffer when its time to display it.

> **Comments:**
> **username_0**: what about `glBlitFramebuffer`? Can't I copy default framebuffer's images or depth to another framebuffer with it?  
> **username_1**: @username_0: Yes, you could. Or you could just render to your own image and *not* have to do a copy. Why pick the slower option?  
> **username_0**: "Why pick the slower option?" maybe this is what I was looking for. I don't know which one is faster so I tried to save texture space. As a solution I will render opaque objects to another framebuff and share its depth buffer with transparency framebuff, this seems better way and fits with your answer I guess  

---

