Re: Java OpenGL(JOGL) Object Arrays and FloatBuffers
Posted by
gouessej on
Dec 10, 2013; 11:20pm
URL: https://forum.jogamp.org/Java-OpenGL-JOGL-Object-Arrays-and-FloatBuffers-tp4030843p4030846.html
Hi
Never pass arrays or indirect NIO buffers to JOGL OpenGL methods or they will be converted into direct NIO buffers anyway. Object pooling is useless since Java 1.4 but you can use mutable objects to avoid creating tons of garbage.
Track direct NIO buffers. Release their native memory manually when you don't need them anymore. It's up to you to take care of the native heap, not the Java heap. If you don't do that, you'll run out of native memory.
No you can use dynamic VBOs too, which is what I do when animating models (key frames).
When I switched to Java + JOGL in 2006, my blueprint became about 5% faster than the original one in C++.
There is no magic, just look at all engines supporting JOGL, mainly Ardor3D (it has a build-in math library).