开发者

How to overlay GLSurfaceView over a CameraPreview in Android?

I am trying to merge two examples from the ApiDemos so one overlay over the other.

1. CameraPreview.java

2. TranslucentGLSurfaceViewActivity.java

I guess GLSurfaceView is not really necessary, I saw demos that uses a GL layer as a Camera PreviewCall开发者_JAVA技巧back, but since I am such a noob at OpenGL, I am kind of lost. Can someone points me toward the light (figuratively speaking)?


Instead of using the setContentView function only use the addContentView function. If you create both views in code you can just pass them as an argument. If a view is created in an xml file, create a View object by inflating the xml with:

 View.inflate(this, R.layout.XMLname, null);

Then you can just add both views and you are done. The trick here is however to add them in the right order. If I recall correctly, even though the logical order might be to first add the camera preview and then the GL surfacview, you need to do it the other way around. In case I am mistaking here, it should be easy to find out the correct order with your two possible options.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜