Hi monkey, I have a serious problem.
first I submit URL for loading some Texture
[java]
Future future = executor.submit(new Callable<Texture> (){
public Texture call() throws Exception {
return assetManager.loadTexture(url);
}
}
);
[/java]
then in update loop in main thread
[java]
…
if( future !=null){
if ( futuer.isCancelled() ){
resetFuture();
}
else if(future.isDone()){
try{
geometry.getMaterial.setTexture(“ColorMap”, future.get());
resetFuture();
}
catch (Exception ex) {
resetFuture();
}
}
}
…
[/java]
however , texture sometime appear , but sometime not.
what happend ???
this is my screenshot , the leftside and right side are the same but only right one are render .
http://i.imgur.com/4lE0A.jpg
Hm, you say “URL”, do you use an URLLocator for some web page? Or you just mean the path for the asset?
yep I already use URLLocator. However, it seem that when I change the code to something like this
[java]
Future future = executor.submit(new Callable<Texture> (){
public Texture call() throws Exception {
Texture t = app.enqueue(new Callable<Texture>() {
public Texture call() throws Exception {
return assetManager.loadTexture(url);
}
}).get();
return t;
}
}
[/java]
it solve the problem , but it seem the performance are slower.
Thanks Normen
The assetmanager should be fully threadsafe however, “only” the scenegraph is not