title: How is glDrawBuffers associated to drawing to a depth texture
body: <p>You can specify what buffers to draw to using<br>
      glDrawBuffer()</p>
  
  <p>example<br>
      GLenum buffers[] = { GL_COLOR_ATTACHMENT0 };<br>
      glDrawBuffers( 1, buffers );</p>
  
  <p>ok so that makes sense.</p>
  
  <p>how about the depth texture though?</p>
  
  <p>so we have here our creation of a frame buffer</p>
  
  <pre><code>    glGenFramebuffers(1, &amp;m_uifboHandle);
  
      // Initialize FBO
      glBindFramebuffer(GL_FRAMEBUFFER, m_uifboHandle);
  
      unsigned int m_uiTextureHandle[2];
      glGenTextures( 2, m_uiTextureHandle );
  
      glBindTexture( GL_TEXTURE_2D, m_uiTextureHandle[x]);
  
      // Reserve space for our 2D render target
      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);
  
      glTexImage2D(GL_TEXTURE_2D, 0, iInternalFormat, uiWidth, uiHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
      glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_uiTextureHandle[0], 0); 
  
      //now the depth     
      glBindTexture(GL_TEXTURE_2D, m_uiTextureHandle[1]);
      glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, uiWidth, uiHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
      glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_uiTextureHandle[1], 0);
  
      glBindFramebuffer(GL_FRAMEBUFFER, 0);
  </code></pre>
  
  <p>so if these steps basically:<br>
  1) make an frame to manipulate to render to<br>
  2) gives us a location for attachment 0 to write to<br>
  3) creates our depth attachment</p>
  
  <p>now how can i write to it? i seen examples where rendering automatically renders to it but i want to understand how binding to write to it works.</p>