當前位置: 首頁>>代碼示例>>Java>>正文


Java Matrix.frustumM方法代碼示例

本文整理匯總了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);
    }
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:17,代碼來源:MyGLRenderer.java

示例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);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:18,代碼來源:LessonEightRenderer.java

示例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);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:19,代碼來源:GLLayer.java

示例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);
}
 
開發者ID:regar007,項目名稱:ShapesInOpenGLES2.0,代碼行數:23,代碼來源:ShapeRenderer.java

示例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);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:19,代碼來源:LessonFiveRenderer.java

示例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);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:19,代碼來源:LessonSixRenderer.java

示例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);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:18,代碼來源:Cube.java

示例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);
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:18,代碼來源:LessonEightRenderer.java

示例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);
    }
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:18,代碼來源:Triangle.java

示例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);
}
 
開發者ID:jphacks,項目名稱:TK_1701,代碼行數:13,代碼來源:GLES.java

示例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);
}
 
開發者ID:FreeSunny,項目名稱:Amazing,代碼行數:9,代碼來源:MyRender.java

示例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);
}
 
開發者ID:PacktPublishing,項目名稱:Building-Android-UIs-with-Custom-Views,代碼行數:8,代碼來源:GLDrawer.java

示例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);
}
 
開發者ID:padster,項目名稱:Muse-EEG-Toolkit,代碼行數:13,代碼來源:GraphGLRenderer.java

示例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);

}
 
開發者ID:livio,項目名稱:sdl_video_streaming_android_sample,代碼行數:16,代碼來源:TextureRender.java

示例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);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:8,代碼來源:GLES20TriangleRenderer.java


注:本文中的android.opengl.Matrix.frustumM方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。