Perraco
Perraco

Reputation: 17380

Flashing black screen in Android under OpenGL ES

in some android test devices, when rendering in opengl 2.0 ES, the screen flashes. I was able to track the problem to the GLSurfaceView class at the point the "eglSwapBuffers" is called, so the flashing is produced on each iteration, on one the screen becomes black and the next has the image I've drawn. So it seams that eglSwapBuffers is not preserving the back buffer on each call producing this flashing behaviour.

Is there anyway to preserve the back buffer? I've found around that maybe I could use the EGL_SWAP_BEHAVIOR_PRESERVED_BIT flag but I can't figure it out how to put it in android, and neither how to use it in old API's such as gingerbread.

Thanks

Upvotes: 2

Views: 937

Answers (1)

ClayMontgomery
ClayMontgomery

Reputation: 2832

You should not need to modify GLSurfaceView. It's much more likely that your problem is caused by the drivers or configuration of your system. I would try a different test device with different graphics drivers. What happens when you run it on an AVD?

It could be that your test device is not making enough memory available to the underlying linux framebuffer device to get the normal triple buffering. Most systems will fall back to single buffering in that case. I recommend that you check these fb device parameters. The virtual_size should be large enough for 2 or 3 buffers for the display mode you are using:

cat /sys/class/graphics/fb0/mode
  U:1024x768p-60
cat /sys/class/graphics/fb0/virtual_size
  800,1440

Upvotes: 1

Related Questions