0
votes

I am trying to create the Light Scattering effect using OpenGL. I am following this tutorial.

At some point it says:

Switch to Orthogonal projection and blend the FBO with the framebuffer, activating the shader in order to generate the "God's ray" effect .

I don't understand what's the meaning of "blend the FBO with the Framebuffer". I looked for this "Blending" and I noticed that's a OpenGL pipeline step.

I was thinking that I should use the function glEnablei(GL_BLEND, fbo), but I don't know where I should call it.

To draw the mesh (the scene has one mesh and one light source) I use glDrawArrays(GL_TRIANGLES, 0, n_of_verteces).

Can someone help me?

1
I do not think you want glEnablei (GL_BLEND, fbo), that's gibberish unless fbo is the index of a single draw buffer (FBO attachment). Generally fbo would be the name of an FBO ;) This is basic multi-pass rendering, and the general procedure is to draw into a texture attachment and then on a second pass, stretch that texture over the viewport with blending setup. To be honest, I don't understand the meaning of "blend the FBO with the Framebuffer" either =P It's a single image attached to the FBO that's of interest here; some parts of an FBO (e.g. depth) blending is meaningless for.Andon M. Coleman

1 Answers

3
votes

Ugh, the instructions you cited are written unneccessarily confusing. What it asks you to do is take the texture you've rendered your god rays to (using the FBO) and draw it on top what's in the main (non-FBO) frame buffer using a single, full viewport textured quad. And the instruction to "blend it" is asking you to enable blending (everything drawn thereafter will blend with what's been drawn in the steps before, including other blended stuff) and choose an appropriate blending function; (GL_ONE, GL_ONE) would be the obvious one for lighting effect stuff.