Author Topic: serialization for Object3D  (Read 2339 times)

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
serialization for Object3D
« on: May 31, 2011, 10:13:12 pm »
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)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: serialization for Object3D
« Reply #1 on: May 31, 2011, 11:09:59 pm »
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

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: serialization for Object3D
« Reply #2 on: May 31, 2011, 11:31:32 pm »
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

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: serialization for Object3D
« Reply #3 on: May 31, 2011, 11:37:22 pm »
whops, my mistake... the old jar (renamed) was still intefering...

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: serialization for Object3D
« Reply #4 on: May 31, 2011, 11:46:05 pm »
now I get a java.io.NotSerializableException: com.threed.jpct.Object3DCompiler

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: serialization for Object3D
« Reply #5 on: June 01, 2011, 12:02:07 am »
Oh, well...try again please.

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: serialization for Object3D
« Reply #6 on: June 01, 2011, 01:44:46 am »
now it's java.io.NotSerializableException: com.threed.jpct.Plane

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: serialization for Object3D
« Reply #7 on: June 01, 2011, 08:14:20 am »
Maybe i should try for myself... ;) Anyway, please try again...

Offline haijin

  • byte
  • *
  • Posts: 37
    • View Profile
Re: serialization for Object3D
« Reply #8 on: June 01, 2011, 12:10:14 pm »
now it's failing at java.i--- oh, wait, it's working now :) thanks