Hi,
I’m doing some volume rendering and want to compose the transparent stuff on top of the solid.
I figured I’d use FBO and a depth texture, two passes:
- Render solid color + depth texture
- Compute transparent color depending on depth texture
Is it possible to use the regular color framebuffer and a depth texture in these steps, or do I need to use a separate color buffer (render/texture buffer) since I’m using FBO?
The specs are a bit unclear here, or rather, I couldn’t find the appropriate section.
Just render normally, disable depth write and use the depth texture as a color texture for the next pass. This should work, since you just use the depth texture through a normal sampler so it reads the texel values as luminance components.
I think the best thing you can do in these situations is just test. That’s what I usually do
I was more curions about the first pass. Should I just set GL_BACK_BUFFER as the draw buffer instead of GL_COLOR_ATTACHMENT0 ?
If there’s a framebuffer set during rendering it will be used anyway. I mean 0 is the default.
Ok. Will try it then. Thanks!
Hm. I get INCOMPLETE_ATTACHMENT back. 0 doesn’t work (glDrawBuffers()), neither does GL_BACK[_LEFT|_RIGHT].
Could you list which textures you have attached and to which slots?
It’s probably a multisample problem. My depth buffer texture isn’t multisampled and I can’t really create one with the current framework. I’ve worked around it for now.