在摄影机视图的OpenGL覆盖 [英] opengl overlay on camera view
本文介绍了在摄影机视图的OpenGL覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我还没有找到一个合适的方式来显示的摄像头preVIEW一个OpenGL覆盖OON顶部,
I still haven't found a proper way to show an opengl overlay oon top of camera preview,
有一个黑客,你叫
setContentView(GLSurfaceView)
addContentView(MyCameraSurfaceView)
但它不能正常工作 - 即当您切换到anouther活动并返回,OpenGL的层心不是显示在相机preVIEW
but it doesn't work properly - i.e. when you switch to anouther activity and go back, the opengl layer isnt displayed over camera preview.
有很多教程并用上述方法的样本,但它只是没有按预期正常工作
there are a lot of tutorials and samples which use the above method, but it simply doesn't work as expected
没有人知道他们是如何做到这一点的拉亚
does anyone know how they do it in layar
推荐答案
它看起来像我已经找到了解决我的问题 - 它的 setZOrderMediaOverlay
功能,我的继承人code:
It looks like I've found the solution to my problem - its setZOrderMediaOverlay
function, heres my code:
private void initViews()
{
mFrame = new FrameLayout(this);
initCameraView();
initGLView();
setContentView( mFrame );
}
private void initGLView()
{
mRenderer = new MyGLRenderer( this );
mGLView = new GLSurfaceView(this);
mGLView.setZOrderMediaOverlay(true);
mGLView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
mGLView.setRenderer(mRenderer);
mGLView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
mFrame.addView( mGLView );
}
private void initCameraView()
{
mCameraSurfaceView = new CameraSurfaceView(this);
mFrame.addView(mCameraSurfaceView);
}
这篇关于在摄影机视图的OpenGL覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文