Serializable Classes in jogl ?

Before I start down the road of trying to implement the fix myself, is there anything that has been done with serialization in regards to JOGL? In particular I’m trying to serialize an object that contains the TextureData class and am having issues with that class. I was going to write a wrapper class around it, however there are some fields which are private in the class that I cannot get to in order to preserve their state…

Thx,

Boltimuss

As a workaround, make TextureData fields of your classes transient and redundantly store the properties you would need to recreate them from scratch. You then can use the standard readObject override to create new TextureData instances after deserialization:


private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
{
  // invode standard deserialization for the non-transient fields
  ois.defaultReadObject();
  // Do whatever is needed to recreate your TextureData members
  // (...)
}

I did think about doing this, however I successfully recompiled the gluegen-rt.jar and jogl.jar with changes made to the actual TextureData class. Now the class can be serialized. I wrote Ken a private message to see if he thinks this change would be worth putting in the source code for jogl :slight_smile: