From d5acf96e62637819d1cd55b516dd03e9232e3971 Mon Sep 17 00:00:00 2001 From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674> Date: 星期二, 28 三月 2017 17:11:20 +0800 Subject: [PATCH] --- VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/MyGLSurfaceView.java | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/MyGLSurfaceView.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/MyGLSurfaceView.java index 1205768..c7d7618 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/MyGLSurfaceView.java +++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/MyGLSurfaceView.java @@ -25,6 +25,8 @@ import android.util.AttributeSet; import android.util.Log; +import com.orhanobut.logger.Logger; + import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; @@ -96,6 +98,8 @@ } } + +// Logger.e("onDrawFrame"); // Ignore the passed-in GL10 interface, and use the GLES20 // class's static methods instead. GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT); @@ -119,12 +123,14 @@ GLES20.glEnableVertexAttribArray(maTextureHandle); checkGlError("glEnableVertexAttribArray maTextureHandle"); - long now = SystemClock.elapsedRealtimeNanos(); - mRunTime += (now - mLastTime); - mLastTime = now; - double d = ((double)mRunTime) / 1000000000; +// long now = SystemClock.elapsedRealtimeNanos(); +// mRunTime += (now - mLastTime); +// mLastTime = now; +// double d = ((double)mRunTime) / 1000000000; Matrix.setIdentityM(mMMatrix, 0); - Matrix.rotateM(mMMatrix, 0, 30, (float)Math.sin(d), (float)Math.cos(d), 0); +// Matrix.rotateM(mMMatrix, 0, 30, (float)Math.sin(d), (float)Math.cos(d), 0); //鍔ㄦ�佺煩闃� +// Matrix.rotateM(mMMatrix, 0, 0, 0, 0, 0); + //Matrix.rotateM(mMMatrix, 0, 0, 0.5f, 0.5f,0); Matrix.multiplyMM(mMVPMatrix, 0, mVMatrix, 0, mMMatrix, 0); Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mMVPMatrix, 0); @@ -141,7 +147,7 @@ // class's static methods instead. GLES20.glViewport(0, 0, width, height); mRatio = (float) width / height; - Matrix.frustumM(mProjMatrix, 0, -mRatio, mRatio, -1, 1, 3, 7); + Matrix.frustumM(mProjMatrix, 0, -mRatio, mRatio, -1, 1, 2, 7); } @Override @@ -213,7 +219,10 @@ mSurface = new SurfaceTexture(mTextureID); mSurface.setOnFrameAvailableListener(this); - Matrix.setLookAtM(mVMatrix, 0, 0, 0, 4f, 0f, 0f, 0f, 0f, 1.0f, 0.0f); + Matrix.setLookAtM(mVMatrix, 0, + 0, 0, 2f, + 0f, 0f, 0f, + 0f, 1.0f, 0.0f); synchronized(this) { updateSurface = false; @@ -320,7 +329,8 @@ private float[] mMVPMatrix = new float[16]; private float[] mProjMatrix = new float[16]; - private float[] mMMatrix = new float[16]; + private float[] mMMatrix = new float[16];// 鍏蜂綋鐗╀綋鐨�3D鍙樻崲鐭╅樀锛屽寘鎷棆杞�佸钩绉汇�佺缉鏀� + private float[] mVMatrix = new float[16]; private float[] mSTMatrix = new float[16]; -- Gitblit v1.8.0