문제

I want to display 3D objects with jPCT, so I use a custum GLSurfaceView.Renderer to display what I want. And below, I need to display a camera preview.

It's work fine but my problem is when I display the 2 SurfaceView (1 for the object and 1 for the camera preview), I had lag on my software. I test it and it's because I use 2 SurfaceView at the same time.

How can I resolve it ? I try to display my 3D object on my camera preview that extends GLSurfaceView :

public class CameraView extends GLSurfaceView implements SurfaceHolder.Callback

But the objects are never display and some functions don't work (Like search an 3D object in a 2D view ...)

Anyone have an idea ?

도움이 되었습니까?

해결책

There's a couple of possibilities. One is that there is some interaction between your renderer threads that is causing lag. Another is that adding an additional layer has caused the system to perform additional GLES composition, and that's slowing you down. (See this doc for background.)

The "objects are never display" statement makes me a bit unsure as to what the actual issue is.

Either way, one approach to correct this is to eliminate the camera SurfaceView. You can send the camera preview to a SurfaceTexture (API 11+) and then render the contents on the main GLSurfaceView as a textured quad. An example of this can be found in the "Texture from Camera" activity in Grafika.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top