scenerygraphics / sciview

sciview is a tool for visualization and interaction with ND image and mesh data
BSD 2-Clause "Simplified" License
64 stars 17 forks source link

Adding too many objects bufferoverflow #100

Closed kephale closed 6 years ago

kephale commented 6 years ago

This happened after ~12,000 spheres were added to the scene (not using instancing, and not using a point cloud). I wasn't particularly surprised by this error, but wanted to document it somewhere for web searchability.

Exception in thread "SciJava-1352ae9a-Thread-0-FPSAWTAnimator#00-Timer0" com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: com.jogamp.opengl.GLException: Caught BufferOverflowException: null on thread SciJava-1352ae9a-Thread-0-FPSAWTAnimator#00-Timer0
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:92)
    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)
Caused by: com.jogamp.opengl.GLException: Caught BufferOverflowException: null on thread SciJava-1352ae9a-Thread-0-FPSAWTAnimator#00-Timer0
    at com.jogamp.opengl.GLException.newGLException(GLException.java:76)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1327)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at jogamp.opengl.GLAutoDrawableBase.defaultDisplay(GLAutoDrawableBase.java:476)
    at com.jogamp.opengl.GLAutoDrawableDelegate.display(GLAutoDrawableDelegate.java:190)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
    ... 4 more
Caused by: java.nio.BufferOverflowException
    at java.nio.DirectFloatBufferU.put(DirectFloatBufferU.java:363)
    at java.nio.FloatBuffer.put(FloatBuffer.java:859)
    at cleargl.GLMatrix.push(GLMatrix.java:594)
    at graphics.scenery.backends.UBO.populate(UBO.kt:228)
    at graphics.scenery.backends.opengl.OpenGLUBO.populate(OpenGLUBO.kt:27)
    at graphics.scenery.backends.opengl.OpenGLRenderer.updateDefaultUBOs(OpenGLRenderer.kt:925)
    at graphics.scenery.backends.opengl.OpenGLRenderer$render$1.doResume(OpenGLRenderer.kt:1329)
    at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:54)
    at kotlinx.coroutines.experimental.DispatchedTask$DefaultImpls.run(Dispatched.kt:161)
    at kotlinx.coroutines.experimental.DispatchedContinuation.run(Dispatched.kt:25)
    at kotlinx.coroutines.experimental.EventLoopBase.processNextEvent(EventLoop.kt:147)
    at kotlinx.coroutines.experimental.BlockingCoroutine.joinBlocking(Builders.kt:244)
    at kotlinx.coroutines.experimental.BuildersKt.runBlocking(Builders.kt:185)
    at kotlinx.coroutines.experimental.BuildersKt.runBlocking$default(Builders.kt:175)
    at graphics.scenery.backends.opengl.OpenGLRenderer.render(OpenGLRenderer.kt:1290)
    at graphics.scenery.backends.opengl.OpenGLRenderer.display(OpenGLRenderer.kt:630)
    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)
    ... 8 more
skalarproduktraum commented 6 years ago

Could you please break at UBO.kt:228 to see at which position of the buffer this exactly happens?

kephale commented 6 years ago

java.nio.DirectByteBuffer[pos=10485760 lim=10485760 cap=10485760]

skalarproduktraum commented 6 years ago

Please have a look at the opengl-dynamic-buffer-resizing branch and let me know if this solves your issue 👍

PS: This should actually be a scenery issue ;)

kephale commented 6 years ago

I cleaned and rebuilt multiple times. Same issue at the same pos/lim/cap.

Yeah, I knew it was a scenery issue, but I thought it was a hardware limit that wouldn't go away so I posted it under sciview so users could find it more easily when they run into it. [expecting more naive users to be using sciview]

skalarproduktraum commented 6 years ago

This issue has been fixed with scenerygraphics/scenery#188 👍