我试图使用GLSurface来显示自定义视图.
我的xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="net.letsense.matrixtest.MainActivity">
<android.opengl.GLSurfaceView
android:layout_width="300dp"
android:layout_height="300dp"
android:id="@+id/my_surface_view"
/>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
我的主要
package net.letsense.matrixtest;
import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
/**
* Created by borislegovic on 03/11/2017.
*/
public class Main extends Activity {
private int mPositionHandle;
private int mColorHandle;
private GLSurfaceView mGLView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create a GLSurfaceView instance and set it
// as the ContentView for this Activity.
// mGLView = new MyGLSurfaceView(this);
// mGLView …Run Code Online (Sandbox Code Playgroud)