How to prevent android OpenGL context being trashed/rebuilt by rotate

opengl

#1

On android, I’ve seen that each time I rotate the device my openGL context is being disposed of and a new context created. I’ve found that this is trashing something somewhere in my app. It seems that after several rotations some of the Images i am using as rendertextures are acting as if they are all suddenly using the MainContentComponents frame buffer instead of one of their own.

I wondered if I could switch off the context being disposed of in this way, and found some older forum posts and google results suggesting this has been a problem brought up before for GLSurfaceView’s - and that I could use setPreserveEGLContextOnPause(true); to prevent this happening. However I have since seen that the opengl code has been changed since that post and GLSurfaceView replaced with a SurfaceView - Is there currently any way to prevent the context being destroyed during rotation on android devices?