i want to capture ar view in my app.
i have been read this thread:
https://developer.vuforia.com/forum/faq/android-how-can-i-capture-ar-view
and i also do what AlessandroB say on this thread:
https://developer.vuforia.com/forum/qcar-api/how-make-screenshot
i try on my project, it didn't show anyerror. but i also didn't got my screenshot.
i didn't see any error in LogCat. i think i must show my code to you, so this my code on ImageTargetsRendered.java
public boolean mTakeScreenshot = false; public void takeScreenshot() { mTakeScreenshot = true; } public void onDrawFrame(GL10 gl) { if (!mIsActive) return; // Update render view (projection matrix and viewport) if needed: //mActivity.updateRenderView(); // Call our native function to render content renderFrame(); // make sure the OpenGL rendering is finalized GLES20.glFinish(); if (mTakeScreenshot==true) { saveScreenShot(0, 0, mViewWidth, mViewHeight, "test.png"); mTakeScreenshot = false; } }
|
that the last part from your code and i add takeScreenshot method that i call in ImageTargets.java with this code:
public void takeScreenshot2(View view) { ImageTargetsRenderer ambil = new ImageTargetsRenderer(); button1.setVisibility(View.INVISIBLE); ambil.takeScreenshot(); button1.setVisibility(View.VISIBLE); }
there is any wrong code that i add??
If you can capture the overlayView (with black background) and the underlying AR view in 2 separate bitmaps,
then what you could try is to combine those bitmaps into one, by manipulating their pixels;
for instance, you could iterate over each pixel of the overlay bitmap, and replace every black pixel with the corresponding pixel from the AR view.
See the Android Bitmap API reference page for how to manipulate pixels:
http://developer.android.com/reference/android/graphics/Bitmap.html