ArrayOutofBounds exception probelm

Started by JavaMan, January 20, 2008, 10:17:24 PM

Previous topic - Next topic

JavaMan

Hi, In my Object3DEditor program I am getting a strange problem when I add triangles to objects in the program. The probelm doesn't always happen just here and there, but it when it happens, it happens after adding a triangle to an object3d in the world. Here is the exception

Exception in thread "Thread-2" java.lang.ArrayIndexOutOfBoundsException: 11
        at com.threed.jpct.Object3D.render(Unknown Source)
        at com.threed.jpct.World.renderScene(Unknown Source)
        at Object3Ds.run(Object3DEditor.java:65)
        at java.lang.Thread.run(Unknown Source)

Any ideas as to what is happening here? The Thread-2 is the Thread that is rendering the world into a JPanel.
thanks v

EgonOlsen

So you are adding data in another thread then rendering? If so, synchronize the two operations. jPCT isn't thread safe, i.e. if you render something while adding data, funny things may happen.

JavaMan

Hi, I made sure the renderer thread and the thread ( which is actually a handler for a button click ) do not access the Object3D at the same time. Unfortunately, I am still getting the OutOfBoundsException. Thanks for the help though. I keep on working at it.
JMan

EgonOlsen

Are you really sure? I'm pretty sure that the problem is related to concurrent access...similar problems always were.

JavaMan

Ok, I will look again. I am actually going to combine the two threads into one, so that won't ( I hope ) be a problem. Maybe in the many lines of code, I didn't realize there was something going on that I didn't no about. Thanks for the help!  ;D
Jman