PDA

View Full Version : what is glBlitFramebufferEXT used for ?



lobbel
04-30-2009, 02:25 AM
Hello,
what is glBlitFramebufferEXT used for ?
I did a bloom shader. So I rendered the object into two
textures (color_attachments) using FBO's. Then i blurred the texture 0 and at the end i draw the fullscreenquad with the
original object from texture 1 and then blend over the blurred
object from texture 0.

but i cant see any geometry drawn after the fullscreen quads. Thats why they are the closest to the camera.

So can i solve this problem with glBlitFramebufferEXT ?

greetings
lobbel

martinsm
04-30-2009, 02:30 AM
You don't need to render object to two textures.
Render object only to one texture.
Then do the bright-pass and do the blur on this texture (preferrably reduced 2x or 4x in size).
Then combine original texture with this blurred texture to get final image.

lobbel
04-30-2009, 02:40 AM
Thakns for you fast answer,

But when I render the object to a texture i cant see it, because its rendered to the texture. Thats why i used 3 textures. Texture 0 and 1 for glow/bloom shader and the texture 2 for the original object. So the bloom shader here is a multipass shader. first pass is horizontal blur, second pass is the vertical blur and the thrid pass is blending. And it works.

But i cant see geometry that has been drawn after the full screen quads. because they are the closes geometry to the camera.

Thats my problem.

you said "Then combine original texture with this blurred texture to get final image. "

looks to me you also use 2 texture (?)


lobbel

martinsm
04-30-2009, 03:46 AM
I don't understand why rendering fullscreen quad has to do something with camera and geometry?
When you are rendering fullscreen quad disable depth test and depth writes. No need for depth testing. Just set up ortho projection (or identity matrix) and quad will be visible.

lobbel
04-30-2009, 09:00 AM
I can see the fullscreen quad. but because its a fullscreen quad i dont see objects that will be drawn later. Before i render the fullscreenquad i set identity matrix.

I want to apply the glow shader not as an post processing effect. and I want to use it for some objects in my scene.

lobbel

martinsm
04-30-2009, 11:44 AM
Then either you should reuse projection matrix and depth buffer for objects drawn at end. Or you could filter objects that don't need to glow in bright-pass, maybe using alfa channel as reference either to glow or not (0-no glow, 1-full glow).