title: glDeleteTextures not deleting texture
body: <p>I'm  trying to write a class to do fragment shader chaining by using a Frame Buffer Object to Render To Texture with a frament shader, then render that texture to another texture with a fragment shader, etc. etc.</p>
  
  <p>I am trying to deal with a memory leak right now, where when I resize my window and delete/reallocate the textures I am using, the textures are not being deleted properly.</p>
  
  <p>Here is a code snippet:</p>
  
  <pre><code>//Allocate first texture
  glGenTextures( 1, &amp;texIds[0] );
  glBindTexture( GL_TEXTURE_2D, texIds[0] );
  glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, screenX, screenY, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
  
  //Allocate second texture
  glGenTextures( 1, &amp;texIds[1] );
  glBindTexture( GL_TEXTURE_2D, texIds[1] );
  glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, screenX, screenY, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
  
  //Try to free first texture -- ALWAYS FAILS
  glDeleteTextures( 1, &amp;texIds[0] );
  //Try to free second texture
  glDeleteTextures( 1, &amp;texIds[1] );
  </code></pre>
  
  <p>When I run this with gDEBugger, it tells me "Warning: The debugged program delete a texture that does not exist. Texture name: 1" when I try to delete texIds[0]. (The reason I have them in an array right now is because I used to creating and free'ing them at the same time, however when you free 2 textures at once, it will fail silently on one and continue with the other).</p>
  
  <p>If I don't create texIds[1], I can free texIds[0], but as soon as I create a second texture, I can no longer free the first texture I create.  Any ideas?</p>