title: OpenGL fragment shader not writing to fbo color buffer
body: <p>I'm having trouble writing from my fragment shader to a color buffer in the FBO. The idea is to draw to this texture, and then draw this texture into a quad.
  The thing is, the shader works when drawing to the default window buffer, since if I remove the FBO, the scene is displayed. And the texturing of the quad works too, I tried it with an imported texture, and it showed. All I'm getting is a black screen. What could have gone wrong? :(</p>
  
  <p>Code for creating the FBO:</p>
  
  <pre><code>glGenFramebuffers(1, &amp;fbo);
  glBindFramebuffer(GL_FRAMEBUFFER, fbo);
  
  glGenRenderbuffers(1, &amp;depthbuff); //Add a depth renderbuffer for depth testing
  glBindRenderbuffer(GL_RENDERBUFFER, depthbuff);
  glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
  glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthbuff);
  
  //Add the buffer to be drawn to and the buffer for the picking information
  glGenTextures(1, &amp;drawbuff);
  glBindTexture(GL_TEXTURE_2D, drawbuff);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, drawbuff, 0);
  
  glGenTextures(1, &amp;pickingbuff);
  glBindTexture(GL_TEXTURE_2D, pickingbuff);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, pickingbuff, 0);
  </code></pre>
  
  <p>Code for rendering:</p>
  
  <pre><code>glBindFramebuffer(GL_FRAMEBUFFER, fbo);
  GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
  glDrawBuffers(2, buffers);
  
  shader-&gt;bind(); //If the three lines above are removed, it draws correctly to the window
  drawStuff();
  </code></pre>
  
  <p>Code for the quad:</p>
  
  <pre><code>quadshader-&gt;bind();
  glEnable(GL_TEXTURE_2D);
  int drawTexID = quadshader-&gt;uniformLocation("drawTex");
  
  glActiveTexture(GL_TEXTURE0);
  //glBindTexture(GL_TEXTURE_2D, anotherTexture); //This works. A texture imported from a TGA
  glBindTexture(GL_TEXTURE_2D, drawbuff);
  glUniform1i(drawTexID, 0);
  
  drawQuad();
  </code></pre>
  
  <p>And lastly, the frag shader, I just set it to draw everything to a solid color:</p>
  
  <pre><code>void main(void) {
      gl_FragData[0] = vec4(1.0, 1.0, 0.0, 1.0);
      gl_FragData[1] = vec4(0.0, 1.0, 1.0, 1.0);
  }
  </code></pre>
  
  <p>EDIT: If it is of any help, the whole thing is in a Qt GLWidget.</p>