[solved]Line update bug

I think there’s a bug in the line-mesh.



If I do the following:



[java]

Geometry g = new Geometry(name);

Line l = new Line(start, end);

g.setMesh(l);

g.setMaterial(/… nifty color …/);



((Line)g.getMesh()).updatePoints(Vector3f.UNIT_X, Vector3f.UNIT_Y);

[/java]



It crashes with a BufferOverflowException on the update-call.



it seems that the problem is that the position of the buffer is at it’s maximum value (6 in this case).

If I do this:

[java]

((Line)line.getMesh()).getBuffer(Type.Position).getData().rewind();

//and then…

((Line)g.getMesh()).updatePoints(Vector3f.UNIT_X, Vector3f.UNIT_Y);

[/java]



The problem is solved.

2 Likes

yep, that will have to rewind. I just committed a fix for it on trunk, give it a try and see if it helps. I didn’t test it, gotta get dinner real quick :stuck_out_tongue:

@Sploreq: looks good and it works. Mission accomplished :slight_smile: