我有一个MediaPlayer
使用 aSurfaceView
来显示视频。现在我想添加一个GlSurfaceView
在MediaPlayerto
视频上渲染一个立方体。我正在使用相对布局。而且我可以分开做这两项工作,但是我不能GlSurfaceView
把SurfaceView
. 它根本不会渲染我用于立方体的 OpenGL 代码。有人可以帮忙吗?
_cube = new CubeGLView(this);
_cube.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
_cube.setId(10002);
_cube.getHolder().setFormat(PixelFormat.TRANSLUCENT);
_cube.getHolder().setFormat(PixelFormat.RGBA_8888);
//_cube.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
_render = new GlRenderer(_cube.getContext());
_cube.setRenderer(_render);
_cube.setVisibility(View.GONE);
RelativeLayout layout = new RelativeLayout(this);
RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
lp.addRule(RelativeLayout.CENTER_IN_PARENT);
mPreview.setLayoutParams(lp);
_cube.setLayoutParams(lp);
layout.addView(_cube);
layout.addView(mPreview);
setContentView(layout, rlp);