Android opengl issue (weird)

谁说我不能喝 提交于 2019-12-04 07:59:07

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...

If you are using textures and vertex buffers I believe those get cleared when you navigate away from a view. If you are getting a SurfaceDestoyed or SurfaceCreated call then I believe you have to recreate the textures and vbos and reload them to the graphics card.

I had a similar problem once where I introduced a bug that messed up the open gl state. Then when I went to another activity (that was hardware accelerated) that activity was all messed up as well. In my case I had to locate the open gl bug I made and fix it.

braden

Could your issue be related to mine? Have a read to make sure it's not: Text only thing visible after pausing GLSurfaceView on Galaxy S3 - Text blur when moved. No button backgrounds

My issue was executing openGL functionality on the UI thread, which corrupted the openGL context used for hardware acceleration.

If you want to test: disable hardware acceleration app wide in the android manifest. If your issue disappears, it's likely the same issue I had. Read my answer to my own question to learn how to fix this issue while leaving hardware acceleration on.

<application android:hardwareAccelerated="false" ...>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!