Buffer undefined result

hello, for my sprite lib.

when i create a buffer with bigger size that the number of sprites i use, the rest of the positions have undefined result.

ok but the real problem is this.

jme shader can read the buffer beyond the limit. E.g it reads positions [limit, capacity]

ok, i found the problem and fixed my code. The problem was .flip(); method in buffer, after i removed it, it run normally.

Bug : flip(); creates undefined numbers at [limit, capacity] area, so it gives garbage results to the shader. Can you fix that bug in jme ?

Here is what i do:

a) create a buffer with all zeroes [0,capacity]

b) when i want to “set” a sprite i only chance the corresponding position. I leave the rest unmodified(the zeroes mean empty sprite).

c) it works fine.

d) bug: if i dared reduce the area to [0, max_sprites] with .flip();

jme would create garbage at [limit = max_sprites, capacity]

i would only use .flip() to reduce the amount of data transfered to gpu to increase fps. But it doesn’t work.

so due to this bug the speed of the application depends on the size of the buffer initially created and not the number of sprites.

any ideas ?

According to java specification (JDK 21 Documentation - Home):

A buffer's limit is the index of the first element that should not be read or written.

And jme's shaders read beyond the limit, so they violate java's specification.
Which means that this is a bug with jme.