So this means at any point I can only work with one buffer object bound to a ARRAY BUFFER binding?
No, that is the opposite of what I said. Take the following sequence of commands:
glBufferData(GL_ARRAY_BUFFER, byteSize, pData, GL_STATIC_DRAW);
This binds a buffer, allocates it with a particular piece of data and then unbinds it. So… what is stored in the buffer after it is unbound?
pData. That is, exactly what was stored in it by those commands. Unbinding a buffer does not change its contents. It does not affect its state. The buffer does not become empty because it is unbound. It does not become smaller or anything.
The only reason you bound it at all is because
glBufferData only works on a buffer that was bound. You bound it in order to give it data.
Now, what do you suppose happens if we substitute
What happens after the buffer is unbound?
Nothing. It’s still mapped, because being mapped is part of the buffer object’s state. Just like it’s contents. Just like it’s size. And so forth. That doesn’t go away just because you unbound it.
Just as with
glBufferData, the only reason you bound it is because
glMapBuffer only works on a buffer that is bound.
Mapping is not a global construct. It is per-object state. Unmapping is likewise per object. Therefore, if you have a mapped buffer object and you want to unmap it, you must ensure that it is bound so that
glUnmapBuffer knows where to find it.