BufferOverflowException when updating TrailMesh

hi … i am moving a TrailMesh along a Curve with this code:



         location += time / moveTime;
         trailMesh.setTrailFront(curve.getPoint(location), 0.05f, time);
         trailMesh.update(new Vector3f(0, 0, 2));



and when i want it to stop and disappear i call:


      trailMesh.resetPosition(curve.getPoint(0));
      trailMesh.update(new Vector3f(0, 0, 2));



however i get a BufferOverflowException when i set the updateSpeed of the TM to 100. When its 60 i dont seem to geht the exception very often but it still occurs :|


java.nio.BufferOverflowException
   at java.nio.Buffer.nextPutIndex(Buffer.java:495)
   at java.nio.DirectFloatBufferU.put(DirectFloatBufferU.java:245)
   at com.jmex.effects.TrailMesh.updateStep(TrailMesh.java:233)
   at com.jmex.effects.TrailMesh.update(TrailMesh.java:196)
        ...



why is this? bug?

thx,
dhdd

i get the exception from time to time too, but i didn't look into it yet

i have worked this issue for days now. I really have no clue as to why this happens.



i ended up catching the BufferOverflowException with a try catch around the call to TrailMesh.update(…) and it seems like there are no (visible) side effects.



please get back to me if you find the actual solution to this.



thanks,

Andy

For me it usually happened, when i paused the game, and too much time passed between two updates.



Maybe you could write a simple test to reproduce the problem easily, so someone with a bit of spare time could take a look at it.

i unfortunately have no idea if i can make a testcase since the damn thing happens pretty random to me … however it makes a lot of sense what you're saying  :expressionless: i am not updating the TrailMesh for quite some time, since i only need it in special occasions. the exception is thrown after i start updating it again … so you're on to something  :wink:



I'll look into it further.

well well, you let the weekend pass and drink too much. seems like only then can I think clearly monday morning  :stuck_out_tongue:



turns out the problem was that the update method got called outside the GL thread, which happens quite rarely.



well, added the TrailMesh.update(…) method to my aspect and now it works.