multipass shader and glBlitFramebufferEXT, help

Started by
2 comments, last by c-mos 14 years, 11 months ago
Hello, what is glBlitFramebufferEXT used for ? I did a glow/bloom shader (multipass). So I rendered the object into two textures (color_attachments) using FBO's with 3 color-attachments. 0 and 1 for the bloom shader and 2 for the original object. Then i blurred the texture 0 and at the end i draw two fullscreenquads One with the original object from texture 2 and one with the blurred texture (texture 0). I blend texture 0 over the quad that has been textured with the original object. but i cant see any geometry drawn after the fullscreen quads. Thats why they are the closest to the camera, of course. so, can this problem be solved by using glBlitFramebufferEXT ? My idea is, when i render the original object into texture i also save the depthbuffer in a texture as a back up. then when i draw the to fullsreen quads i restore the depthbuffer from texture so that i can see geometry that has been drawn after the fullscreen quads. Is that the correct way or absolutely nonsense ? If yes, can someone tell me how this works more in detail ? And if its the wrong way, maybe some can me tell the right way. thanks c-mos
Advertisement
too stupid or too simple this question ? or why is nobody answering ? :(
its used to copy data (fast) from one FBO to another (including the main framebuffer)
IIRC there are restrictions with depth targets though, eg they must be the same size
If u have the depth info stored as a texture though theres no need to worry about glBlitFramebuffer as u can instead just draw the depthtexture into the scene as a fullscreen sized quad.
Thank you,
anyway i found another solution. (maybe not the correct way)
I use more texture i can render to. So when drawing begins i active the render to texture mode. In the first texture i draw all objects.. In the second texture i draw objects that have to glow. If they dont have to glow i also draw them into texture 2 but i set their color to 0 and alpha to 0 as well. In my glow shader i "igonore" pixels with alpha 0. That means, I multiply the color value in my shader with the alpha value. And whether its 1 or 0. At the end i draw a fullscreen quad with the origina l objects and then blend over the glowed texture.

But back to the depth buffer story. When i create my fbo i also create a renderbuffer and add this with depthcomponent to the fbo. how can i write
the stored depthbuffer into the framebuffer ? or do i need a framebuffer instead of a renderbuffer but with the parameter depth_component ?

greetings,
cmos

This topic is closed to new replies.

Advertisement