Home » Android » framebuffer – How to read the current frame buffer in android?

framebuffer – How to read the current frame buffer in android?

Posted by: admin May 14, 2020 Leave a comment

Questions:

Is there a method to read the frame buffer of the current screen? I searched some data about the frame buffer. Some one used the glReadPixels method, but the information was not enough. Does anyone know how to read the current frame buffer in detail?

Thanks for helping.

How to&Answers:

Do you actually want the screen framebuffer? Or some OpenGL surface that your app has created?

If the former, see
How to capture the android device screen content?

If the latter, you are on the right track with glReadPixels.

Answer:

in cmd line

  1. adb shell screencap -p /sdcard/abc.png
  2. adb pull /sdcard/abc.png
  3. find your screen capture png file in your adb directory.

Edit according to Chris Stratton :

If you gonna implement this cmd in Java code, root permission is needed

thanks for pointing out my mistake!