serialization for Object3D

Started by haijin, May 31, 2011, 10:13:12 PM

Previous topic - Next topic

haijin

I seem to have a problem serializing Object3D... I am using a workaround which is not that nice (re-instancing with relevant data instead of serializing). I wonder why is that happening: trying to serialize generates errors because it can't serialize (unrelated) stuff like GLThread or other threads. In this trace, ThrowableObject3D line 32 is for writeObject(object3D):
I/RunActivity(19405): Unable to save game state java.io.NotSerializableException: android.opengl.GLSurfaceView$GLThread
W/System.err(19405): java.io.NotSerializableException: android.opengl.GLSurfaceView$GLThread
W/System.err(19405):    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1547)
W/System.err(19405):    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1859)
W/System.err(19405):    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1701)
W/System.err(19405):    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1665)
W/System.err(19405):    at java.util.HashMap.writeObject(HashMap.java:1025)
W/System.err(19405):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(19405):    at java.lang.reflect.Method.invoke(Method.java:521)
W/System.err(19405):    at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1229)
W/System.err(19405):    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1587)
W/System.err(19405):    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1859)
W/System.err(19405):    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1701)
W/System.err(19405):    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1665)
W/System.err(19405):    at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:1153)
W/System.err(19405):    at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:420)
W/System.err(19405):    at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1251)
W/System.err(19405):    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1587)
W/System.err(19405):    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1859)
W/System.err(19405):    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1701)
W/System.err(19405):    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1665)
W/System.err(19405):    at com.loxai.run.ThrowableObject3D.writeObject(ThrowableObject3D.java:32)

EgonOlsen

There's a cache for matrices that uses the thread as key. It wasn't transient...i've changed this and uploaded a new alpha version. Please give it a try: http://www.jpct.net/jpct-ae/download/alpha/jpct_ae.jar

haijin

I replaced the library but I'm getting an error with MemoryHelper:

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/threed/jpct/util/MemoryHelper;

... even after restarting the IDE

haijin

whops, my mistake... the old jar (renamed) was still intefering...

haijin

now I get a java.io.NotSerializableException: com.threed.jpct.Object3DCompiler

EgonOlsen


haijin

now it's java.io.NotSerializableException: com.threed.jpct.Plane

EgonOlsen

Maybe i should try for myself... ;) Anyway, please try again...

haijin

now it's failing at java.i--- oh, wait, it's working now :) thanks