Hi, I was doing some debugging with openGL mapped buffers (specifically in lwjgl), and I ran into something that suggests I may have the wrong idea about buffer mappings. The documentation doesn’t say much about it, and I looked for an ARB spec txt (since those always seem to do a better job of fleshing out the details), but haven’t found one, so I’m hoping someone can clarify this for me.
How I thought they worked:
- calling glMapBuffer for a target that has another buffer already mapped to it would effectively unmap the first one and map the new one
- calling glUnMapBuffer just unmaps whatever buffer is currently mapped to that target (generates error if there are none)
What appears to be the case now (from my debugging):
- calling glMapBuffer for a target that has another buffer already mapped to it will result in both buffers being mapped to that target
- calling glUnMapBuffer for a target that has a buffer bound to it will unmap that buffer if it is currently mapped (error otherwise), and leave any other mappings to the same target unchanged
- calling glUnMapBuffer for a target that has no buffer bound to it will unmap all buffers that are bound to that target (not so sure about this one)
The new situation means it’s possible to map multiple buffers to the same target, which I would find particularly useful because I often need to have multiple different buffers mapped simultaneously, and I’m kindof running out of targets to use for the mappings… but I need to be sure that this is actually what is supposed to happen before I can safely use it. I haven’t found any documentation that makes it clear.
Thanks for any help.