Android SurfaceView to Bitmap

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
kekanekolohe
Gnoblar
Posts: 6
Joined: Sun Apr 06, 2014 8:26 am

Android SurfaceView to Bitmap

Post by kekanekolohe »

So I'm trying to do something that should be relatively easy. On Android, I want to capture the contents of the SurfaceView Ogre renders to. I've tried overriding the onDraw and draw methods of a custom SurfaceView, but have only managed to create a BitMap with all zeros for pixels. Perhaps I need to do something after the call to "renderOneFrame"?

If anyone has experience with this, I would appreciate the help. Otherwise, once I figure it out, I'll post my solution here.
kekanekolohe
Gnoblar
Posts: 6
Joined: Sun Apr 06, 2014 8:26 am

[Solved] Android SurfaceView to Bitmap

Post by kekanekolohe »

So I was hoping for a simple solution where I could simply grab the contents of the SurfaceView Ogre uses and copy it to an ImageView, but as mentioned, I was never successful in accomplishing this. In the end, I solved the problem by using Ogre's render-to-texture (rtt) and creating an ImageView from it's contents.

If anyone's got a better solution, I'd love to hear it.