According to the OpenGL spec, glMapBufferRange can access the contents of any buffer, including buffers larger than 2GB:https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glMapBufferRange.xhtml
(GLintptr and GLsizeiptr are 64 bits on a 64-bit system, which LWJGL appropriately takes care of through 'long' parameters)
In LWJGL, however, glMapBufferRange returns a java.nio.ByteBuffer, which is a big issue.
A ByteBuffer has attributes such as 'position', 'limit' and 'capacity', that are defined in byte units. Unfortunately, ByteBuffer use 'ints' (integers) to define these values.
Because of this, ByteBuffer access won't work with buffer larger than 2GB.
I tested the following : if you call glMapBufferRange with a very large region (much larger than 2GB), it succeeds (as per OpenGL spec). However, the returned ByteBuffer is useless, as it won't work past its 'limit'.
I cannot use .asIntBuffer() as a workaround, as the returned ByteBuffer capacity is negative, and invalid.
What can I do to use glMapBufferRange with large buffers?