Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screenshot? #15

Open
GoogleCodeExporter opened this issue Jan 29, 2016 · 6 comments
Open

Screenshot? #15

GoogleCodeExporter opened this issue Jan 29, 2016 · 6 comments

Comments

@GoogleCodeExporter
Copy link

Hi all,

I'm currently trying to add a screen-shot function to DroidAR. However I only 
have a black image.

I added my code in the onDrawFrame function but it's maybe not the right 
location for it.

Please find enclosed, my GLRenderer.java override. I know that the call to this 
feature is working because I can get an image (but a black...).

Thanks,

Hidden

Original issue reported on code.google.com by dev.hidd...@gmail.com on 22 Sep 2011 at 1:52

Attachments:

@GoogleCodeExporter
Copy link
Author

first try to read the pixels after creating the scene, so after all the objects 
are traversed. so just put it at the end of the draw method. and the difficult 
part will be to merge the opengl bitmap with the camera image;)

maybe you should move your code to a seperate class otherwise you might get 
problems when the renderer class is changed.

Original comment by simon.heinen on 22 Sep 2011 at 3:19

@GoogleCodeExporter
Copy link
Author

Hi Simon,

Thank you for your answer. Actually my first attempt was putting the code at 
the end of the onDrawFrame method --> same result.

Do you mean that the the opengl bitmap is an overlay above the camera view? I 
thought you were merging all those elements... (it explains my black image).

Original comment by dev.hidd...@gmail.com on 22 Sep 2011 at 3:38

@GoogleCodeExporter
Copy link
Author

jep they are two separate overlays (the camerapreview and the opengl surface 
view) so currently you are only getting the information from the opengl view. 

im using glReadPixel in a similar way in the ObjectPicker ( 
http://code.google.com/p/droidar/source/browse/trunk/droidar/DroidAR/src/gl/Obje
ctPicker.java ) class:

                ByteBuffer pixelBuffer = ByteBuffer.allocateDirect(4);
                pixelBuffer.order(ByteOrder.nativeOrder());
                gl.glReadPixels(x, y, 1, 1, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE,
                                pixelBuffer);
                byte b[] = new byte[4];
                pixelBuffer.get(b);

so it should be possible to read all pixels on the screen this way (im not sure 
if its the best way, sounds a little inefficient;). just make sure that you do 
this after rendering all the objects in the elementsToRender list

the merging with the camera preview should be possible to if you write some 
little helper methods to manage the transparency in the opengl view. i'm 
currently busy learning for 2 exams but i should have some time in about one 
week, you can post your progress here till then.

Original comment by simon.heinen on 22 Sep 2011 at 6:21

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Thanks simon! Actually I also quite busy right now, but I'll try to have a look 
at it later. I'll keep you posted!

Original comment by dev.hidd...@gmail.com on 23 Sep 2011 at 7:57

@GoogleCodeExporter
Copy link
Author

have this been successful? thank you I also want to capture an image with the 
openGL bitmaps

Original comment by dwayne.b...@gmail.com on 3 Oct 2012 at 2:56

@GoogleCodeExporter
Copy link
Author

this framework is so nice,but i can't use it taking pictures.who can help me?

Original comment by liuting....@gmail.com on 6 Nov 2014 at 1:58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant