I've been experimenting with ARCore for the past few months. I have read almost all the documentation. Talking in reference to the sample app, what I want to do is to extract the superimposed image from the app i.e a frame containing the camera texture and also the bots drawn by opengl (like a screenshot). In preview 2, they have provided TextureReader class which extracts just the camera texture. I've been trying a lot but haven't been able to succeed in getting the superimposed image. Is there a way to do it or is it just impossible?
Asked
Active
Viewed 1,286 times
2 Answers
0
I think basically you want to have a screenshot from the OpenGL view. This question should help you: Screenshot on android OpenGL ES application

Steven Mohr
- 1,167
- 6
- 19
-
Thanks a lot . man!! Both answers are correct , I accepted Clayton's because he specifically mentioned to capture at the end of drawFrame which was my mistake as I thought that order won't matter as glReadPixels would read the previous frame. Duh me !! – Tushar Rain Jan 22 '18 at 07:20
0
Sample code specifically for the HelloAR sample to capture the image (and save it to the device) is in this answer: How to take picture with camera using ARCore

Clayton Wilkinson
- 4,524
- 1
- 16
- 25
-
Thanks, it worked!! I was using the same approach . My only mistake was calling glReadPixels before everything was drawn. I misinterpreted the description of glReadPixels and assumed it would read the previous frame if current frame was incomplete :( – Tushar Rain Jan 22 '18 at 07:21
-
btw, as i had already read and now experienced :), glReadPixels is really slow. I don't expect it but is there any alternative to it? – Tushar Rain Jan 22 '18 at 08:40
-
I am able to capture the frame. As you can see in this [video](https://www.youtube.com/watch?v=GFhpAe10qnk) , remote side is also able to interact with AR environment. How to achieve this functionality wherein two users can interact with the same frame but only one is actually capturing it? – Tushar Rain Jan 29 '18 at 09:03