How to read the current frame buffer in android?
Asked Answered
N

2

11

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.

Nay answered 16/11, 2010 at 12:33 Comment(0)
T
4

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.

Thoria answered 16/11, 2010 at 13:4 Comment(0)
S
0

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!

Susannsusanna answered 18/12, 2013 at 8:16 Comment(1)
No, root permission is not needed to do what you have shown here. adb provides the necessary permission to use those particular tools - that's how the DDMS screenshot button works. However, you cannot use those tools from code on device without some sort of hack, as adb only listens on the USB connection by default.Samsara

© 2022 - 2024 — McMap. All rights reserved.