1、配置layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<MyGLSurfaceView android:id="@+id/surfaceView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
2、自定义GLSurfaceView
public class MyGLSurfaceView extends GLSurfaceView {
private float mAspect = 0;
public MyGLSurfaceView(Context context) {
super(context);
init();
}
public MyGLSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init(){
se