title: Attaching Framebuffer to Texture error
body: <p>I am trying to implement shadow mapping with the tutorial <a href="http://ogldev.atspace.co.uk/www/tutorial23/tutorial23.html" rel="nofollow">here</a>, however when I try to use this code to attach a Framebuffer to a texture it fails. My OpenGL context is 3.1 and I believe i have an Intel 3000 series graphics card. The code fails at 2 points. The first failure is at <code>glFramebufferTexture2D</code>, which gives error code 1282 (Not sure what enumeration that corresponds too). I believe this error is causing the assert <code>assi</code> later in the code to fail. I have tried code from similar questions but they do not seem to work in this case.</p>
  
  <pre><code>glGenFramebuffers(1, &amp;MObject::fbo);
  glGenTextures(1, &amp;MObject::shadowMap);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, windowWidth, windowHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  glBindFramebuffer(GL_FRAMEBUFFER, MObject::fbo);
  glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, MObject::shadowMap, 0);
  GLenum  err = glGetError(); // Error code: 1282
  glDrawBuffer(GL_NONE);
  glReadBuffer(GL_NONE);
  GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
  assi(status == GL_FRAMEBUFFER_COMPLETE, "FBO error!"); // Expression is false, abort called.
  </code></pre>