Hi
I am trying to load 5-6 md2 model on my GL. But it it taking more time and my app become stuck (Black screen) . So i tried to lode it in background using thread or AsyncTask. But i am getting null pointer error in onDrow() . when i used any model object . otherwise blank screen (without model).
class LoadModelAsyncTask extends AsyncTask<Void, Integer, Boolean>
{
protected Boolean doInBackground(Void... params)
{
System.out.println("i m doInBackground");
ogro=loadModel(Environment.getExternalStorageDirectory() +"/texture_one.jpg",Environment.getExternalStorageDirectory() + "/logo_one.md2",0.25f);
ogroA=loadModel(Environment.getExternalStorageDirectory() +"/texture_one.jpg",Environment.getExternalStorageDirectory() + "/circle_one.md2",0.25f);
return null;
}
protected void onPostExecute(Boolean result)
{
System.out.println("i m onPostExecute");
world.addObject(ogro);
world.addObject(ogroA);
world.buildAllObjects();
}
}
and call it in
onSurfaceChange() {
mLoadModelAsyncTask = new LoadModelAsyncTask();
mLoadModelAsyncTask.execute();
cam.lookAt(ogro.getTransformedCenter()); ........1
cam.lookAt(ogroA.getTransformedCenter());.........2
}
here geting null pointer in line 1 and 2..aswell onDrow().
if any solution pls ..reply soon..!!