Hi,
In my demo, I've got almost 20 objects and corresponding textures. Everything at this moment works, but when I just change one of these objects to be downloaded from somewhere, I get out of memory error. Is there any tips for that?
(Finally I have to download all of these 20 objects, similar to waterput)
Here after getting the .md2 file, I add it to the world.
waterput = Loader.loadMD2(stream("waterput.md2"),1f);
tm.addTexture("waterput", new Texture(res.openRawResource(R.raw.waterputtex)));
waterput.setTexture("waterput");
waterput.clearAnimation();
waterput.translate(170, -35, -130);
world.addObject(waterput);
waterput.strip();
This is the method which gets a name, receives the object from a URL and returns it.
BufferedInputStream stream(String name) throws IOException{
//TODO
String objURL = "http://www.xxx.edu/xxx/"+name;
URLConnection conn = new URL(objURL).openConnection();
conn.connect();
BufferedInputStream bis = new BufferedInputStream(conn
.getInputStream());
Loader.clearCache();
return bis;
}
btw, I do not need all the keyframes in the .md2 files, so I call clearAnimation() to remove them.