|Project:||The Open Toolkit library|
GL takes a pointer to the buffer passed in and writes to that memory on the next call to Gl.RenderMode.
The code pins for the duration of the call, but this pattern requires the memory be pinned throughout the intervening operations.
The only example code I could find (in the forums), fails to do this., and it's not mentioned that pinning is required in the docs.
I would suggest removing the GL.SelectBuffer(Int32 size, Int buffer) signatures, leaving only the GL.SelectBuffer(Int32 size, Int *buffer) signatures, so people at least realize that the memory needs to be pinned.
The other alternative is to have the library track the buffer that's been set in the current context and pin the memory on calls to GL.SelectBuffer, unpinning when the buffer address is changed.
If nothing else the XML docs should include a statement to the effect that the memory must be pinned or allocated from the unmanaged heap.