title: OpenGL - FBO and alpha blending
body: <p>I was finding for answer, but I can't get answer for my problem.</p>
  
  <p>I have FBO and I can't get alpha blending and multisample to work. FBO draws scene to texture and then it's drown to default framebuffer with two textured triangles. Drawing directly to default framebuffer is fine.</p>
  
  <p>Here is difference between default framebuffer (top) and my FBO (bottom).</p>
  
  <p><img src="https://i.stack.imgur.com/kDC0K.png" alt="enter image description here"></p>
  
  <p>I use FBO with 2x color attachments and 1x depth attachments. (Only GL_COLOR_ATTACHMENT0 is used, second is for other function)</p>
  
  <p>Depth test: Disabled</p>
  
  <p>Blending: Enabled</p>
  
  <p>Multisample: Enabled</p>
  
  <p>Blending function: GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA</p>
  
  <p>Any ideas? What am I doing wrong? I can't blend any transparent objects, there is no alpha. If you require more code, I can edit post.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This code is deeper in code structure, I hope, I extracted it properly.</p>
  
  <p>Setup FBO:</p>
  
  <pre><code>glGenFramebuffers(1, &amp;_framebuffer);
  glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer);
  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color0_texture_id, 0);
  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, color1_texture_id, 0);
  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth_texture_id, 0);
  </code></pre>
  
  <p>Setup color texture:</p>
  
  <pre><code>glGenTextures(1, &amp;texture_id);
  glBindTexture(GL_TEXTURE_2D, texture_id);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_FLOAT, NULL);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  </code></pre>
  
  <p>Depth texture is the same except one line:</p>
  
  <pre><code>// This is probably wrong
  glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Blending is working now, but still no multisample. How to do it?</p>