package net.ddns.mahaljsp.opengl_glsurfaceview;

import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.util.Log;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

/**
 * Created by Thomas Wu(mahaljsp@gmail.com) on 2017/1/10.
 */

public class MyRenderer implements GLSurfaceView.Renderer {
    int count=0;
    long t1;
    Triangle triangle;
    @Override
    public void onSurfaceCreated(GL10 notUsed, EGLConfig eglConfig) {
        triangle=new Triangle();
    }
    @Override
    public void onSurfaceChanged(GL10 notUsed, int i, int i1) {}
    @Override
    public void onDrawFrame(GL10 notUsed) {
        triangle.onDraw();
        count++;
        long now = System.currentTimeMillis();
        if (now - t1 >= 1000) {
            t1 = now;
            Log.d("Thomas", Thread.currentThread().getName() + " : " + count);
            count = 0;
        }
    }
}
