Ok, so here is my other suspect, even though it is not the direct cause of the crash, it doesn’t work as expected, and might indirectly cause problems:
I want to load a texture from a PBO. Loading the texture works fine, but filling the data does not. If I fill the PBO like this, then it works (ie. the data gets uploaded):
BindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, name);
BufferData(GL_PIXEL_UNPACK_BUFFER_ARB, size, image, GL_DYNAMIC_DRAW);
BindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
But, if I use Map(), and then copy the data, then the result is an empty buffer (black texture, after upload):
BindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, name);
void* data = MapBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, GL_READ_WRITE);
BindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
::memcpy(data, image, size);
BindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, name);
UnmapBuffer(GL_PIXEL_UNPACK_BUFFER_ARB);
BindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
The reason I want to use Map instead of BufferData, is that I want to fill the data in from a separate thread, and would like to avoid having a temporary buffer to copy from. Anyway, this might, or might not have anything to do with the crash. I’ll keep investigating.