2

i have an image view and a GLSurfaceView i am trying to add an image view on GLSurfaceView. I am working on a app in which i am adding image view on a GLSurfaceview and then should get the screenshot of the whole GLSurfaceView including image view. now i am having problem in adding the imageview in GLSurfaceView Do i have to draw the image view on GLSurfaceView.(if yes then how would i draw it) i have found this

but this is not matched with my requirements . The saved image looks different from the image on running app.

Community
  • 1
  • 1
Varun Chaudhary
  • 370
  • 4
  • 19
  • Rendering a View, and grabbing a screen shot, are different things. Which are you trying to do? cf. http://stackoverflow.com/questions/27817577/android-take-screenshot-of-surface-view-shows-black-screen/ – fadden Mar 23 '15 at 15:28
  • i want to first adding the view into opengl and then grab the screenshot of the whole screen which should have the view in the screenshot. – Varun Chaudhary Mar 24 '15 at 06:00
  • 2
    @VarunChaudhary I assume the imageview has to be the background image of GLSurfaceView. If that is the case, i suggest, draw the image ( in `ImageView` ) directly as a texture in `GLSurfaceView` and then use `glReadPixels` to get the full screenshot. Forget the `ImageView` class. Compositing ImageView and GLSurfaceView might not be as easy. Fore more http://stackoverflow.com/a/12899426/1180117 – kiranpradeep Mar 24 '15 at 10:35
  • 1
    Yup, forget the ImageView and use a texture. Do everything in GLES. Grafika (https://github.com/google/grafika) has examples of generating a texture from an image, and of capturing and saving the current frame with `glReadPixels()` (https://github.com/google/grafika/blob/master/src/com/android/grafika/gles/EglSurfaceBase.java#L152 is simpler and more efficient than the example in the other answer). – fadden Mar 24 '15 at 15:11

0 Answers0