cansik / pointcloud-processing

A point cloud visualisation and analysis library for Processing.
23 stars 7 forks source link

IntBuffer throws because of Negative capacity with 3 million points #1

Closed cansik closed 5 years ago

cansik commented 5 years ago

If you try to allocate a buffer with 3 million points, the allocateDirectIntBuffer method throws a Negative capactiy exception.

java.lang.IllegalArgumentException: Negative capacity: -415875072
    at java.nio.Buffer.<init>(Buffer.java:199)
    at java.nio.ByteBuffer.<init>(ByteBuffer.java:281)
    at java.nio.ByteBuffer.<init>(ByteBuffer.java:289)
    at java.nio.MappedByteBuffer.<init>(MappedByteBuffer.java:89)
    at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:119)
    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311)
    at ch.bildspur.pointcloud.attribute.IntAttribute.allocateDirectIntBuffer(IntAttribute.java:58)
    at ch.bildspur.pointcloud.attribute.IntAttribute.allocate(IntAttribute.java:39)
    at ch.bildspur.pointcloud.PointCloudBuffer.allocate(PointCloudBuffer.java:26)
    at BasicSketch.setup(BasicSketch.java:53)
    at processing.core.PApplet.handleDraw(PApplet.java:2425)
    at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:866)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)