Use 2 SurfaceView make lag

Started by rtSJ, May 07, 2014, 02:29:32 PM

Previous topic - Next topic

rtSJ

Hello everyone !

My problem today is that I use 2 SurfaceView at the same time in my AR software. One is for display the camera of the device. It's a custum class that extends SurfaceView :
public class CameraView extends SurfaceView implements SurfaceHolder.Callback

The second is a GLSurfaceView where I render all my objects with jPCT :

setmGLView(new GLSurfaceView(this.application));
setCameraView(new CameraView(this.context));

setRenderer(new MyRenderer());
getmGLView().setRenderer(getRenderer());
getRenderer().initialize();


But when the both are display, a little lag come. But when I display only one, it's good and very fluent.

Maybe It's not the good solution to display my camera on an other SurfaceView. But I don't understand how to correct the problem and delete the lag. Anyone have an idea ?

EgonOlsen

What exactly do you mean by "lag"? Low frame rates or a delayed camera image and/or rendering or...???

rtSJ

I mean delayed camera image.

But I think it's the fault of my device because on an other device I haven't any delayed images... So I think you can't do anything for me. But if you have an idea about it, I'm happy to heard it.

EgonOlsen

Maybe adding a Thread.sleep(...) into the rendering code will give the camera thread more time to update. However, it will reduce 3d frame rate, but it might be worth a try.