title: Bloom effect using downscaling (downsampling) technique using OpenGL/GLSL
body: <p>Hello I'm trying to implement Bloom effect in my program. In fact, I've already implemented the effect using a highlight pass and a separate gaussian blur pass.</p>
  
  <p>Here's an example:</p>
  
  <p>Bright pass texture:</p>
  
  <p><img src="https://i.stack.imgur.com/5Jqkg.png" alt="enter image description here"></p>
  
  <p>Gaussian blur render pass (2 internal passes for this effect):</p>
  
  <p><img src="https://i.stack.imgur.com/NAUnj.png" alt="enter image description here"></p>
  
  <p>And finally the final pass (brightPass + BlurPass):</p>
  
  <p><img src="https://i.stack.imgur.com/CKBEf.png" alt="enter image description here"></p>
  
  <p>(I want to precise I don't have implemented HDR tone mapping yet).</p>
  
  <p>But I found a very interesting article from intel:</p>
  
  <pre><code>https://software.intel.com/en-us/articles/compute-shader-hdr-and-bloom
  </code></pre>
  
  <p>It said :</p>
  
  <p>"First the bright pass is performed where values below a specified threshold are filtered out. The bright pass output is then downscaled by half 4 times. Each of the downscaled bright pass outputs are blurred with a separable Gaussian filter and then added to the next higher resolution bright pass output."</p>
  
  <p>I understood how it works but I did not understand how to perform texture downscaling using OpenGL. However I know if I use glGenerateMipmap() function (at the initialization of my FBO) with 4 mipmap levels I think I will have my 4 downscaled texture directly with the desired format (1/16, 1/8, 1/4 and 1/2) like it's written in the article.</p>
  
  <p>But my problem is I can't find the way to do this!</p>
  
  <p>Does it exist a way to bind the other textures generated using mipmaping and use them in the fragment shader? Should I have to render the bright pass 4 times with 4 separates FBOs applying different formats (1/16, ...). I think it's a solution but it's probably not correct about the performance. I think the bright pass should be rendered once using the window max size and then using the downscaled textures (mipmap) already loaded in memory but I don't know how to bind and use them into my shaders! I'm really lost.</p>
  
  <p>Thanks a lot in advance for your help!</p>