Author Topic: Use 2 SurfaceView make lag  (Read 2001 times)

Offline rtSJ

  • byte
  • *
  • Posts: 21
    • View Profile
Use 2 SurfaceView make lag
« on: May 07, 2014, 02:29:32 pm »
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 :
Code: [Select]
public class CameraView extends SurfaceView implements SurfaceHolder.Callback
 The second is a GLSurfaceView where I render all my objects with jPCT :
Code: [Select]
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 ?
« Last Edit: May 23, 2014, 09:34:15 am by rtSJ »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Use 2 SurfaceView make lag
« Reply #1 on: May 08, 2014, 12:16:55 pm »
What exactly do you mean by "lag"? Low frame rates or a delayed camera image and/or rendering or...???

Offline rtSJ

  • byte
  • *
  • Posts: 21
    • View Profile
Re: Use 2 SurfaceView make lag
« Reply #2 on: May 12, 2014, 03:50:22 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Use 2 SurfaceView make lag
« Reply #3 on: May 12, 2014, 04:13:05 pm »
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.