How to pause/resume ofxAssimpModelLoader on Android?

I have problems with pausing/resuming ofxAssimpModelLoader on Android. It seems that the main problem are the vbos.

I tried a lot of different things in the reloadTexture() to reload the model:

  • model.load(path); //reloading
  • model.clear();
  • modelMesh.vbo.clear();
  • model = new ofxAssimpModelLoader();
  • etc…

But still no success. Any hint would be appreciated.

Hi!

I have the same issue.

In early versions (OF 0.8.2) i solve this reloading manually the “setup objects” when the app resumes. But now it doesn’t work.

I’m trying to solve this for a few days and have no results. I will post the answer if i found it.

Any help is welcome :slight_smile:

We solved it on of080, see the code below. It should work on the newer versions too.

testApp::setup() {
    reloadTextures(); //to not to write the same loader code twice
}

testApp::pause() {
    model->clear();
}

testApp::reloadTextures() {
    model->loadModel(modelpath, false);
}

And we wrote a lot of code inside ofxAssimpModelLoader::clear(). I don’t remember which part was for this issue but it seems these lines should do the job:

ofxAssimpModelLoader::clear() {
    for (unsigned int i = 0; i < modelMeshes.size(); ++i){
        modelMeshes[i].vbo.clear();
    }
}

Thanks!!!

It works!!