Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android opengl issue (weird)

this is a weird one. I have a basic application (dashboard, ...) and a GLSurfaceview in which I draw 3D objects and textures. All runs pretty but when I go back in other activities, hmm well a screenshot is better than words:

This is the dashboard before

Before

this is the opengl: opengl

And this is my dashboard when I press back: enter image description here

As you can see, the images are gone and text too. I run on 4.0+ so I suppose this is because android draws elements with opengl, as it doesn't do that on my 2.2 device.

Do you have an idea of what is causing this? It does not happen when I don't use texture btw.

like image 231
AMerle Avatar asked Jan 25 '13 23:01

AMerle


1 Answers

Ok I found what was wrong to me. I was deleting textures on the UI Thread, by calling mTextureManager.deleteAllTextures() on my fragment's onPause();

I solved it by deleting my textures with a

mSurfaceView.queueEvent(new Runnable(){
    //delete all textures here
}

Hope this will help other guys...

like image 125
AMerle Avatar answered Sep 21 '22 11:09

AMerle