Login  Register

Re: Buffers.newDirectIntBuffer(int[]) does not set limit

Posted by jmaasing on Jul 24, 2015; 1:50pm
URL: https://forum.jogamp.org/Buffers-newDirectIntBuffer-int-does-not-set-limit-tp4034959p4034961.html

OMG I'm sorry I left out a piece of code that I use. The 'working' case is this:

final IntBuffer indexBuf = Buffers.newDirectIntBuffer(triIndexes.length);
for (int triIndex : triIndexes) {
	indexBuf.put(triIndex) ;
}
indexBuf.flip();

The flip() part is the essential thing and I think more appropriate than clear() in the Buffers class.

Sorry I do not have a build setup for gluegen where I can test the patch :-/