title: Getting GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT with depth texturing
body: <p>I have been trying to implement shadow-mapping for a long time, and I am using Lance Williams' technique (which is rendering the scene twice, once in light space and once in view space). However, when I call <code>glCheckFramebufferStatus</code> on <code>GL_FRAMEBUFFER</code>, I get <code>GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT</code>, <em>after</em> I have called <code>glFramebufferTexture2D</code> on it. I am confused, because that error is thrown when there isn't a texture or renderbuffer attached to the framebuffer, but I think I <em>do</em> have a texture attached to it.</p>
  
  <p>Here is my code run in <code>init</code>:</p>
  
  <pre><code>    gl.glEnable(GL2.GL_TEXTURE_2D);
  
      // generate stuff
      IntBuffer ib = IntBuffer.allocate(1);
      gl.glGenFramebuffers(1, ib);
      frameBuffer = ib.get(0);
      gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, frameBuffer);
  
      ib = IntBuffer.allocate(1);
      gl.glGenTextures(1, ib);
      depthTexture = ib.get(0);
      gl.glBindTexture(GL2.GL_TEXTURE, depthTexture);
  
      // prevents 'shadow acne'
      gl.glPolygonOffset(2.5f, 0);
      // prevents multiple shadows
      gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP_TO_EDGE);
      gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP_TO_EDGE);
      // prevents (or expects!!!) pixel-y textures
      gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
      gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST);
      // store one value in all four components of pixel
      gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_DEPTH_TEXTURE_MODE, GL2.GL_INTENSITY);
  
      gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT, GL2.GL_TEXTURE_2D, depthTexture, 0);
      gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_DEPTH_COMPONENT16, 1024, 1024, 0, GL2.GL_DEPTH_COMPONENT, GL2.GL_FLOAT, null);
      gl.glDrawBuffer(GL2.GL_NONE);
      gl.glReadBuffer(GL2.GL_NONE);
      int FBOStatus = gl.glCheckFramebufferStatus(GL2.GL_FRAMEBUFFER);
      // FBOStatus == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
  </code></pre>
  
  <p><strong>EDIT</strong>: I ran this method in a practically empty project too (throwing the error)</p>