4
$\begingroup$

I'm trying to implement Weighted, Blended Order-Independent Transparency

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?

$\endgroup$

1 Answer 1

3
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ what about glBlitFramebuffer? Can't I copy default framebuffer's images or depth to another framebuffer with it? $\endgroup$
    – recp
    Feb 7, 2018 at 18:03
  • 1
    $\begingroup$ @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? $\endgroup$ Feb 7, 2018 at 20:15
  • $\begingroup$ "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 $\endgroup$
    – recp
    Feb 7, 2018 at 20:18

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .