本文整理了Java中android.opengl.Matrix.frustumM()
方法的一些代码示例,展示了Matrix.frustumM()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.frustumM()
方法的具体详情如下:
包路径:android.opengl.Matrix
类名称:Matrix
方法名:frustumM
暂无
代码示例来源:origin: robolectric/robolectric
@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void testFrustumJB_MR1() {
float[] expected = new float[]{
0.005f, 0, 0, 0,
0, 0.02f, 0, 0,
1.5f, 5, -1.020202f, -1,
0, 0, -2.020202f, 0,
};
float[] output = new float[16];
Matrix.frustumM(output, 0, 100, 500, 200, 300, 1, 100);
assertThat(output).usingExactEquality().containsAllOf(expected);
}
代码示例来源:origin: robolectric/robolectric
@Test
@Config(minSdk = JELLY_BEAN, maxSdk = JELLY_BEAN)
public void testFrustumM() {
// this is actually a bug
// https://android.googlesource.com/platform/frameworks/base/+/0a088f5d4681fd2da6f610de157bf905df787bf7
// expected[8] should be 1.5
// see testFrustumJB_MR1 below
float[] expected = new float[]{
0.005f, 0, 0, 0,
0, 0.02f, 0, 0,
3f, 5, -1.020202f, -1,
0, 0, -2.020202f, 0,
};
float[] output = new float[16];
Matrix.frustumM(output, 0, 100, 500, 200, 300, 1, 100);
assertThat(output).usingExactEquality().containsAllOf(expected);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
public void frustum(float left,float right,float bottom,float top,float near,float far){
Matrix.frustumM(mMatrixProjection,0,left,right,bottom,top,near,far);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//计算宽高比
float ratio=(float)width/height;
//设置透视投影
Matrix.frustumM(mProjectMatrix, 0, -ratio, ratio, -1, 1, 3, 20);
//设置相机位置
Matrix.setLookAtM(mViewMatrix, 0, 1.0f, -10.0f, -4.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//计算变换矩阵
Matrix.multiplyMM(mMVPMatrix,0,mProjectMatrix,0,mViewMatrix,0);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//计算宽高比
float ratio=(float)width/height;
//设置透视投影
Matrix.frustumM(mProjectMatrix, 0, -ratio, ratio, -1, 1, 3, 20);
//设置相机位置
Matrix.setLookAtM(mViewMatrix, 0, 1.0f, -10.0f, -4.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//计算变换矩阵
Matrix.multiplyMM(mMVPMatrix,0,mProjectMatrix,0,mViewMatrix,0);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//计算宽高比
float ratio=(float)width/height;
//设置透视投影
Matrix.frustumM(mProjectMatrix, 0, -ratio, ratio, -1, 1, 3, 20);
//设置相机位置
Matrix.setLookAtM(mViewMatrix, 0, 5.0f, 5.0f, 10.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//计算变换矩阵
Matrix.multiplyMM(mMVPMatrix,0,mProjectMatrix,0,mViewMatrix,0);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//计算宽高比
float ratio=(float)width/height;
//设置透视投影
Matrix.frustumM(mProjectMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
//设置相机位置
Matrix.setLookAtM(mViewMatrix, 0, 0, 0, 7.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//计算变换矩阵
Matrix.multiplyMM(mMVPMatrix,0,mProjectMatrix,0,mViewMatrix,0);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//计算宽高比
float ratio=(float)width/height;
//设置透视投影
Matrix.frustumM(mProjectMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
//设置相机位置
Matrix.setLookAtM(mViewMatrix, 0, 0, 0, 7.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//计算变换矩阵
Matrix.multiplyMM(mMVPMatrix,0,mProjectMatrix,0,mViewMatrix,0);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//计算宽高比
float ratio=(float)width/height;
//设置透视投影
Matrix.frustumM(mProjectMatrix, 0, -ratio, ratio, -1, 1, 3, 20);
//设置相机位置
Matrix.setLookAtM(mViewMatrix, 0, 0.0f, 0.0f, 10.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//计算变换矩阵
Matrix.multiplyMM(mMVPMatrix,0,mProjectMatrix,0,mViewMatrix,0);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//计算宽高比
float ratio=(float)width/height;
//设置透视投影
Matrix.frustumM(mProjectMatrix, 0, -ratio, ratio, -1, 1, 3, 20);
//设置相机位置
Matrix.setLookAtM(mViewMatrix, 0, 1.0f, -10.0f, -4.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//计算变换矩阵
Matrix.multiplyMM(mMVPMatrix,0,mProjectMatrix,0,mViewMatrix,0);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//计算宽高比
float ratio=(float)width/height;
//设置透视投影
Matrix.frustumM(mProjectMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
//设置相机位置
Matrix.setLookAtM(mViewMatrix, 0, 0, 0, 7.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//计算变换矩阵
Matrix.multiplyMM(mMVPMatrix,0,mProjectMatrix,0,mViewMatrix,0);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
//计算宽高比
float ratio=(float)width/height;
//设置透视投影
Matrix.frustumM(mProjectMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
//设置相机位置
Matrix.setLookAtM(mViewMatrix, 0, 0, 0, 7.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//计算变换矩阵
Matrix.multiplyMM(mMVPMatrix,0,mProjectMatrix,0,mViewMatrix,0);
}
代码示例来源:origin: glumes/AndroidOpenGLTutorial
public static void setProjectFrustum
(
float left, //near面的left
float right, //near面的right
float bottom, //near面的bottom
float top, //near面的top
float near, //near面与视点的距离
float far //far面与视点的距离
) {
Matrix.frustumM(mProjMatrix, 0, left, right, bottom, top, near, far);
}
代码示例来源:origin: JimSeker/opengl
@Override
public void onSurfaceChanged(GL10 unused, int width, int height) {
// Adjust the viewport based on geometry changes,
// such as screen rotation
GLES20.glViewport(0, 0, width, height);
float ratio = (float) width / height;
// this projection matrix is applied to object coordinates
// in the onDrawFrame() method
Matrix.frustumM(mProjectionMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
}
代码示例来源:origin: qiubiteme/android_api_demos
public void onSurfaceChanged(GL10 glUnused, int width, int height) {
// Ignore the passed-in GL10 interface, and use the GLES20
// class's static methods instead.
GLES20.glViewport(0, 0, width, height);
float ratio = (float) width / height;
Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
}
代码示例来源:origin: FacePlusPlus/MegviiFacepp-Android-SDK
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
// 设置画面的大小
GLES20.glViewport(0, 0, width, height);
float ratio = (float) width / height;
ratio = 1; // 这样OpenGL就可以按照屏幕框来画了,不是一个正方形了
// this projection matrix is applied to object coordinates
// in the onDrawFrame() method
Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
// Matrix.perspectiveM(mProjMatrix, 0, 0.382f, ratio, 3, 700);
}
代码示例来源:origin: glumes/AndroidOpenGLTutorial
public void onSizeChanged(int width, int height) {
GLES20.glViewport(0, 0, width, height);
final float ratio = (float) width / height;
final float left = -ratio;
final float right = ratio;
final float bottom = -1.0f;
final float top = 1.0f;
final float near = 1.0f;
final float far = 6.0f;
Matrix.frustumM(projectionMatrix, 0, left, right, bottom, top, near, far);
}
代码示例来源:origin: THEONE10211024/ApiDemos
public void onSurfaceChanged(GL10 glUnused, int width, int height) {
// Ignore the passed-in GL10 interface, and use the GLES20
// class's static methods instead.
GLES20.glViewport(0, 0, width, height);
float ratio = (float) width / height;
Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
}
代码示例来源:origin: MasayukiSuda/GPUVideo-android
@Override
public void onSurfaceChanged(final int width, final int height) {
Log.d(TAG, "onSurfaceChanged width = " + width + " height = " + height);
filterFramebufferObject.setup(width, height);
previewFilter.setFrameSize(width, height);
if (glFilter != null) {
glFilter.setFrameSize(width, height);
}
aspectRatio = (float) width / height;
Matrix.frustumM(ProjMatrix, 0, -aspectRatio, aspectRatio, -1, 1, 5, 7);
Matrix.setIdentityM(MMatrix, 0);
}
代码示例来源:origin: MasayukiSuda/GPUVideo-android
@Override
public void onSurfaceChanged(int width, int height) {
filterFramebufferObject.setup(width, height);
previewShader.setFrameSize(width, height);
if (glFilter != null) {
glFilter.setFrameSize(width, height);
}
scaleRatio = (float) width / height;
Matrix.frustumM(ProjMatrix, 0, -scaleRatio, scaleRatio, -1, 1, 5, 7);
}
内容来源于网络,如有侵权,请联系作者删除!