[FIXED] LWJGL3 - glMapBuffer

Started by abcdef, November 27, 2014, 09:25:43

Previous topic - Next topic

abcdef

Hi

I noticed GL15.glMapBuffer is slightly different in LWJGL3

public static java.nio.ByteBuffer glMapBuffer(int target,
                              int access,
                              int length,
                              java.nio.ByteBuffer old_buffer)


In LWJGL2 I am using a long as the length, long is also used in the SubData version in LWJGL3

public static void glGetBufferSubData(int target,
                      long offset,
                      long size,
                      java.nio.ByteBuffer data)

spasi

This is an interesting find, thanks. BUFFER_SIZE is indeed an int64 and I'll make sure any usages are fixed.

For this particular case though, the length parameter is a virtual one added by LWJGL, the original native function does not have it. It sets the capacity of the returned ByteBuffer and the problem is that NIO buffers are limited to 32bit addressing. So, making it a long won't be beneficial now, but it may be in the future. Afaik there are lots of people doing off-heap memory management that complain about this issue (mostly related to server-side stuff, like NoSQL solutions, high-frequency traders etc).

spasi

This has been fixed in nightly build #28.