By joeyk2512
on Sun, 01/04/2015 - 14:00
Hi, I'm trying to freeze the background for my app. I'm not sure if I'm using the correct way or term. Basically, I want to stop the camera from updating once I tap on the screen.
I'm using this page as a reference. https://developer.vuforia.com/resources/dev-guide/freezing-video-background
However, I'm having a problem. I'm getting an error from running this particular code at line 15.
state = Renderer.getInstance().begin( frozenState );
I've noted that this function actually returns void.
void com.qualcomm.vuforia.Renderer.begin | ( | State | state ) |
Marks the beginning of rendering for the given frame. Use this to draw a specific camera frame, rather than the latest available one.
So, naturally, eclipse wouldn't let me run it. So I removed the "state =".
Renderer.getInstance().begin( frozenState );
And this came out in my LogCat
01-03 00:16:02.624: E/AndroidRuntime(22737): FATAL EXCEPTION: GLThread 233201-03 00:16:02.624: E/AndroidRuntime(22737): java.lang.NullPointerException: Attempt to dereference null QCAR::State01-03 00:16:02.624: E/AndroidRuntime(22737): at com.qualcomm.vuforia.VuforiaJNI.Renderer_begin__SWIG_1(Native Method)01-03 00:16:02.624: E/AndroidRuntime(22737): at com.qualcomm.vuforia.Renderer.begin(Renderer.java:67)01-03 00:16:02.624: E/AndroidRuntime(22737): at com.qualcomm.vuforia.samples.VuforiaSamples.app.ImageTargets.ImageTargetRenderer.renderFrame(ImageTargetRenderer.java:266)01-03 00:16:02.624: E/AndroidRuntime(22737): at com.qualcomm.vuforia.samples.VuforiaSamples.app.ImageTargets.ImageTargetRenderer.onDrawFrame(ImageTargetRenderer.java:148)01-03 00:16:02.624: E/AndroidRuntime(22737): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1527)01-03 00:16:02.624: E/AndroidRuntime(22737): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1244) I'm not sure what is the problem here. Is it something to do with a Null Pointer? But I've checked the "frozenState" before I begin() it. It's not Null.
Freezing the Video Background by using State
Fixed. I've used frozenState = state.clone(); instead of frozenState = state;
Freezing the Video Background by using State
closing thread.