5
« on: July 22, 2016, 04:35:31 pm »
I am actually experiencing a new issue.
My attempt is to transfer the object3d in a JSon enconding by serializing the object3d and the texture which I learned from the docs to be Serializable as well.
The result is that the model is rendered, but it is not textured. This is basically what I'm doing in a separate thread that than adds the object to a thread safe queue that the ondraw method polls to look for new objects:
public void run(){
JSONObject job = new JSONObject(message);
Boolean successful = (Boolean) job.get("successful");
if(successful){
String basename = job.getString("basename");
byte[] txtr =(org.apache.commons.codec.binary.Base64.decodeBase64(job.getString("file").getBytes()));
Texture texture = Object3DManager.deserializeTexture(txtr);
Log.e(TAG, "textured!");
if(texture==null)
Log.e(TAG,"texture==null");
TextureManager.getInstance().addTexture(basename, texture);
byte[] obj3Ddata = (org.apache.commons.codec.binary.Base64.decodeBase64(job.getString("obj3d").getBytes()));
Log.e(TAG,"obj3Ddata len:"+obj3Ddata.length);
Object3D o3d = Object3DManager.deserializeObject3D(/*blob.array()*/obj3Ddata);
jpctWorldManager.addObjectToCreationQueue(o3d,loc);
}
else {
Log.e(TAG, job.getString("message"));
return;
}
}
Is it better to call build() on the sender or the receiver side?
Also the untextured model moves in a bursty way, as I rotate the camera.
Any help would be great.
Thanks