title: How does glDeleteTextures and glDeleteBuffers work?
body: <p>Basically, in my code I hook the glDeleteTextures and glBufferData functions. I store a list of textures and a list of buffers. The buffer list holds checksums and pointers to the buffer. The below code intercepts the data before it reaches the graphics card.</p>
  
  <pre><code>Hook_glDeleteTextures(GLsizei n, const GLuint* textures)
  {
      for (int I = 0; I &lt; n; ++I)
      {
          if (ListOfTextures[I] == textures[I])       //??? Not sure if correct..
          {
              //Erase them from list of textures..
          }
      }
  
      (*original_glDeleteTextures)(n, textures);
  }
  </code></pre>
  
  <p>And I do the same thing for my buffers. I save the buffers and textures to a list like below:</p>
  
  <pre><code>void Hook_glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
  {
      Buffer.size = size;
      Buffer.target = target;
      Buffer.data = data;
      Buffer.usage = usage;
  
      ListOfBuffers.push_back(Buffer);
      (*original_glBufferData(target, size, data, usage);
  }
  </code></pre>
  
  <p>Now I need to delete whenever the client deletes. How can I do this? I used a debugger and it seems to know exactly which textures and buffers are being deleted.</p>
  
  <p>Am I doing it wrong? Should I be iterating the pointers passed and deleting the textures?</p>