OK I looked into the code you gave me and I feel like I have a better understanding of my options now. However I'm having some trouble with the LineStripArray class.
1 2 3 4 5 6 7
| points[length] = new Point3d(x,y,z); length++; if (length < 2) return; lines = new LineStripArray(points.length, GeometryArray.COORDINATES, stripLengths); lines.setCoordinates(0, points); |
gives me this:
1 2 3
| Exception in thread "main" java.lang.NullPointerException at javax.media.j3d.GeometryArrayRetained.setCoordinates(GeometryArrayRetained.java:4033) at javax.media.j3d.GeometryArray.setCoordinates(GeometryArray.java:1401) |
stripLengths looks like this:
stripLengths = new int[] {100};
and points looks like this:
points = new Point3d[100];
so why am I getting a NullPointerException? This only happens after the scene starts and I try to recreate "lines" as you see in the first block of code. I've found 2 examples online of people creating new LineStripArray's during animation for this same effect and aparantly it works for them. What am I missing?
EDIT: Also, if I don't re-initialize lines, I can call the setCoordinate() method successfully before the application starts rendering, but if I call it afterward I get the NullPointerException.