本文整理匯總了Java中android.opengl.Matrix.frustumM方法的典型用法代碼示例。如果您正苦於以下問題:Java Matrix.frustumM方法的具體用法?Java Matrix.frustumM怎麽用?Java Matrix.frustumM使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.opengl.Matrix
的用法示例。
在下文中一共展示了Matrix.frustumM方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
public void onSurfaceChanged(GL10 unused, 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 = 2.0f;
final float far = 10.0f;
// this projection matrix is applied to object coordinates
// in the onDrawFrame() method
// Matrix.frustumM(mProjectionMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
}
示例2: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height) {
// Set the OpenGL viewport to the same size as the surface.
GLES20.glViewport(0, 0, width, height);
// Create a new perspective projection matrix. The height will stay the
// same while the width will vary as per aspect ratio.
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 = 1000.0f;
Matrix.frustumM(projectionMatrix, 0, left, right, bottom, top, near, far);
}
示例3: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height) {
// Set the OpenGL viewport to the same size as the surface.
GLES20.glViewport(0, 0, width, height);
// Create a new perspective projection matrix. The height will stay the
// same
// while the width will vary as per aspect ratio.
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 = 10.0f;
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
}
示例4: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height)
{
_width = width;
_height = height;
// Set the OpenGL viewport to the same size as the surface.
GLES20.glViewport(0, 0, width, height);
// Create a new perspective projection matrix. The height will stay the same
// while the width will vary as per aspect ratio.
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 = 5000.0f;
Matrix.frustumM(aProjectionMatrix, 0, left, right, bottom, top, near, far);
}
示例5: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height)
{
// Set the OpenGL viewport to the same size as the surface.
GLES20.glViewport(0, 0, width, height);
// Create a new perspective projection matrix. The height will stay the same
// while the width will vary as per aspect ratio.
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 = 10.0f;
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
}
示例6: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height)
{
// Set the OpenGL viewport to the same size as the surface.
GLES20.glViewport(0, 0, width, height);
// Create a new perspective projection matrix. The height will stay the same
// while the width will vary as per aspect ratio.
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 = 1000.0f;
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
}
示例7: initProjectionMatrix
import android.opengl.Matrix; //導入方法依賴的package包/類
public void initProjectionMatrix(int width, int height) {
// Set the OpenGL viewport to the same size as the surface.
GLES20.glViewport(0, 0, width, height);
// Create a new perspective projection matrix.
// The height will stay the same.
// while the width will vary as per aspect ratio.
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 = 10.0f;
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
}
示例8: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 glUnused, int width, int height) {
// Set the OpenGL viewport to the same size as the surface.
GLES20.glViewport(0, 0, width, height);
// Create a new perspective projection matrix. The height will stay the
// same while the width will vary as per aspect ratio.
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 = 1000.0f;
Matrix.frustumM(projectionMatrix, 0, left, right, bottom, top, near, far);
}
示例9: initProjectionMatrix
import android.opengl.Matrix; //導入方法依賴的package包/類
public void initProjectionMatrix(int width, int height) {
// Set the OpenGL viewport to the same size as the surface
GLES20.glViewport(0, 0, width, height);
// Create a new perspective projection matrix.
// while the width will vary as per aspect ratio.
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 = 10.0f;
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
}
示例10: gluPerspective
import android.opengl.Matrix; //導入方法依賴的package包/類
public static void gluPerspective(float[] m,
float angle,float aspect,float near,float far) {
float top=near*(float)Math.tan(angle*(Math.PI/360.0));
float bottom=-top;
float left=bottom*aspect;
float right=top*aspect;
float[] frustumM=new float[16];
float[] resultM=new float[16];
Matrix.frustumM(frustumM,0,left,right,bottom,top,near,far);
Matrix.multiplyMM(resultM,0,m,0,frustumM,0);
System.arraycopy(resultM,0,m,0,16);
}
示例11: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
GLES20.glViewport(0, 0, width, height);
float ratio = (float) width / height;
Matrix.frustumM(projectionMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
}
示例12: 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.frustumM(mProjectionMatrix, 0, -ratio * 2, ratio * 2, -2, 2, 2, 7);
}
示例13: GraphGLRenderer
import android.opengl.Matrix; //導入方法依賴的package包/類
/** Create a renderer that draws a given duration of time. */
public GraphGLRenderer(Context ctx, int durationSec) {
this.ctx = ctx;
this.durationSec = durationSec;
// Set up the view matrix, projection, then combine to make MVP matrix
float[] mViewMatrix = new float[16];
float[] mProjectionMatrix = new float[16];
Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.frustumM(mProjectionMatrix, 0, -1, 1, -1, 1, 3, 7);
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mViewMatrix, 0);
}
示例14: surfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
public void surfaceChanged(int width, int height) {
mWidth = width;
mHeight = 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);
}
示例15: onSurfaceChanged
import android.opengl.Matrix; //導入方法依賴的package包/類
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);
}