I've been working on a program using OpenGL for a while now and I recently started getting an error occasionally on this line:
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexID);
Here is the error that comes up, though I don't think it'll help too much:
First-chance exception at
0x0000000069E03C13
(nvoglv64.dll) in Voxel.exe:0xC0000005
: Access violation reading location0x000000000AA87000
.
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.
How can I track down and/or fix what's causing this access violation?