Login  Register

Re: IntBuffers

Posted by Xerxes Rånby on Dec 16, 2013; 11:21am
URL: https://forum.jogamp.org/IntBuffers-tp4030910p4030914.html

lpvb wrote
I noticed in the docs that a lot of methods take IntBuffers as an alternative to arrays. Can anyone explain this reasoning? Is it faster or something?
All methods that share data at the same time with the OpenGL driver implementation and Java must be passed as a "memory pinned" java NIO buffers. By using "memory pinned" java NIO buffers guards from crashes that will happen if the java garbage collector is allowed to move the buffer while it is in use by the OpenGL driver thus it is a technical requirement. Functions where OpenGL must make a copy of the memory content according to opengl specification can be allowed to still use arrays.