2
我有一個MediaPlayer
使用SurfaceView
來顯示視頻。現在我想在MediaPlayerto
上添加一個GlSurfaceView
以在視頻上渲染一個立方體。我正在使用相對佈局。而且我可以將兩項工作分開,但我無法將GlSurfaceView
置於SurfaceView
之上。它只是不渲染我用於多維數據集的OpenGL代碼。 有人可以幫忙嗎?Android GLSurfaceView over MediaPlayer-SurfaceView
_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);