本文整理匯總了Java中android.opengl.Matrix.perspectiveM方法的典型用法代碼示例。如果您正苦於以下問題:Java Matrix.perspectiveM方法的具體用法?Java Matrix.perspectiveM怎麽用?Java Matrix.perspectiveM使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.opengl.Matrix
的用法示例。
在下文中一共展示了Matrix.perspectiveM方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onDrawFrame
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onDrawFrame(int textureId) {
super.onDrawFrame(textureId);
glSphereProgram.use();
sphere.uploadTexCoordinateBuffer(glSphereProgram.getTextureCoordinateHandle());
sphere.uploadVerticesBuffer(glSphereProgram.getPositionHandle());
Matrix.perspectiveM(projectionMatrix, 0, 90, ratio, 1f, 500f);
Matrix.multiplyMM(modelViewMatrix, 0, viewMatrix, 0, modelMatrix, 0);
Matrix.multiplyMM(mMVPMatrix, 0, projectionMatrix, 0, modelViewMatrix, 0);
GLES20.glUniformMatrix4fv(glSphereProgram.getMVPMatrixHandle(), 1, false, mMVPMatrix, 0);
TextureUtils.bindTexture2D(textureId, GLES20.GL_TEXTURE0,glSphereProgram.getTextureSamplerHandle(),0);
sphere.draw();
}
示例2: StereoDiveEffect
import android.opengl.Matrix; //導入方法依賴的package包/類
public StereoDiveEffect(Context context) {
mDpm = new DisplayMetrics();
mActivity = context;
getWindowManager(context).getDefaultDisplay().getMetrics(mDpm);
generateVideoVertices();
generateVideoTextures();
generateUITextures();
mCamera = new float[16];
mPersp = new float[16];
mMVP = new float[16];
mHeadTransform = new float[16];
mAngleOrigin = new float[3];
Matrix.setIdentityM(mHeadTransform, 0);
Matrix.perspectiveM(mPersp, 0, EYE_FOV, 1.0f, 0.0f, -(1.5f*SCREEN_FAR));
mRightEyePos = new float[] { 0.0f, -IPD/2.0f, 0.0f };
mLeftEyePos = new float[] { 0.0f, IPD/2.0f, 0.0f };
}
示例3: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 unused, int width, int height) {
GLES20.glViewport(0, 0, width, height);
float aspectRatio = (float) width / height;
// Recompute the projection matrix, because it depends on the aspect ration of the display.
Matrix.perspectiveM(projMatrix, 0, FOV_Y, aspectRatio, NEAR_CLIP, FAR_CLIP);
}
示例4: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 unused, int width, int height) {
GLES20.glViewport(0, 0, width, height);
Matrix.perspectiveM(mProjectionMatrix, 0, 45, (float) width / height, 1f, 10f);
Matrix.setIdentityM(mModelMatrix, 0);
Matrix.translateM(mModelMatrix, 0, 0f, 0f, -2.5f);
Matrix.rotateM(mModelMatrix, 0, -60f, 1f, 0f, 0f);
Matrix.multiplyMM(mTmpMatrix, 0, mProjectionMatrix, 0, mModelMatrix, 0);
System.arraycopy(mTmpMatrix, 0, mProjectionMatrix, 0, mTmpMatrix.length);
}
示例5: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 unused, int width, int height) {
GLES20.glViewport(0, 0, width, height);
float ratio = (float) width / height;
Matrix.perspectiveM(mProjectionMatrix, 0, 90, ratio, 0.1f, 7.f);
}
示例6: updateViewPortAndProjection
import android.opengl.Matrix; //導入方法依賴的package包/類
public void updateViewPortAndProjection(int width, int height) {
GLES31.glViewport(0, 0, width, height);
mSurfaceAspectRatio = (float) width / height;
// this projection matrix is applied to object coordinates
Matrix.perspectiveM(mProjectionMatrix, 0, 45.0f, mSurfaceAspectRatio, 0.1f, 30.0f);
}
示例7: setScaleFactor
import android.opengl.Matrix; //導入方法依賴的package包/類
public void setScaleFactor(float _scaleFactor) {
Matrix.perspectiveM(mProjectionMatrix, 0, 45.0f / _scaleFactor, mSurfaceAspectRatio, 0.1f, 30.0f);
}
示例8: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
public void onSurfaceChanged(GL10 unused, int width, int height) {
GLES20.glViewport(0, 0, width, height);
float ratio = (float)width/(float)height;
Matrix.perspectiveM(projection, 0, 45.0f, ratio, 0.1f, 10.0f);
}