GLSurfaceView onPause uncleared frame remains behind

70 Views Asked by At

I'm having an issue with rendering on GLSurfaceView. If I QUICKLY onPause/onResume the app sometimes I end up with some leftover uncleared frame, which I cannot clear or get rid of..

easiest way to reproduce would be to press App Overview or Home button on navigation panel and then immediately reopen the app by pressing on the task preview)

The onDrawFrame(gl: GL10) is called with gl.glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) and I tried with gl.glClearColor(0F, 0F, 0F, 0F) too. But it only works for the current objects, the shadow from before I cannot get rid of.. I just cannot seem to reach that surface anymore.

enter image description here

This is not happening everytime, if I slowly onPause/onResume the app there will be no "shadows".

Here is the link to my sample Android project, where this issue can be reproduced. It's rather basic, so maybe you'd like to take a look at the code (engine/Renderer.kt & MainActivity.kt).

My main goal is to eliminate the possibility of getting these "shadows" on rendered frame from before onPause. I'm open to any suggestions, any answer, even if it's a workaround/lifehack. It just has to remove these leftowers.

0

There are 0 best solutions below