title: Access Violation at glBindBuffer
body: <p>I've been working on a program using OpenGL for a while now and I recently started getting an error occasionally on this line:</p>
  
  <pre><code>glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexID);
  </code></pre>
  
  <p>Here is the error that comes up, though I don't think it'll help too much:</p>
  
  <blockquote>
    <p>First-chance exception at <code>0x0000000069E03C13</code> (nvoglv64.dll) in
    Voxel.exe: <code>0xC0000005</code>: Access violation reading location
    <code>0x000000000AA87000</code>.</p>
  </blockquote>
  
  <p>The address given for the access violation varies, and the time it takes for the violation to occur also varies. Given that the time it takes for the access violation to occur varies, I'm guessing it has to do with two threads trying to access the same data, but there's never any other thread working on the same object when the violation occurs, and I'm using mutexes to make sure that two threads can't write to the same data. I've checked and made sure that the ID for index buffer is valid, and since the only thread that generates and deletes buffer IDs is also the only thread that binds and transfers data into the buffers, I don't believe it's possible for the access violation to be because of that.</p>
  
  <p>How can I track down and/or fix what's causing this access violation?</p>