尼玛,搞了一年多引擎,苦逼的我又开始研究起android开发来了
手里有个需求需要使用Opengl 画YUV格式的视频数据,所以就写了小东东,结果丫的就是获取不了view,代码如下
先看代码好了
1,继承opengl的surfaceView的类
public class MyGLSurface extends GLSurfaceView {
private MyGLRender mMyGLRender;
public MyGLSurface(Context context) {
super(context);
}
public MyGLSurface(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyGLSurface(Context context, AttributeSet attrs, int defStyle) {
super(context);//这里这么写也是很不厚道的
}
}
2,再次继承了上面的类,用来处理一些UI以外的逻辑
public class MyGLViewForLogic extends MyGLSurface {
public MyGLViewForLogic(Context context) {
super(context);
initVideoView();
}
public MyGLViewForLogic(Context context, Attr