当前位置: 首页>>代码示例>>Java>>正文


Java GLU.gluPerspective方法代码示例

本文整理汇总了Java中android.opengl.GLU.gluPerspective方法的典型用法代码示例。如果您正苦于以下问题:Java GLU.gluPerspective方法的具体用法?Java GLU.gluPerspective怎么用?Java GLU.gluPerspective使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.opengl.GLU的用法示例。


在下文中一共展示了GLU.gluPerspective方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
	gl.glViewport(0, 0, width, height);
	mViewportWidth = width;
	mViewportHeight = height;

	float ratio = (float) width / height;
	mViewRect.top = 1.0f;
	mViewRect.bottom = -1.0f;
	mViewRect.left = -ratio;
	mViewRect.right = ratio;
	updatePageRects();

	gl.glMatrixMode(GL10.GL_PROJECTION);
	gl.glLoadIdentity();
	if (USE_PERSPECTIVE_PROJECTION) {
		GLU.gluPerspective(gl, 20f, (float) width / height, .1f, 100f);
	} else {
		GLU.gluOrtho2D(gl, mViewRect.left, mViewRect.right,
				mViewRect.bottom, mViewRect.top);
	}

	gl.glMatrixMode(GL10.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:ichason,项目名称:PageCurl,代码行数:26,代码来源:CurlRenderer.java

示例2: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int width, int height) {
		if(height == 0) { 						
			height = 1;
		}


		gl.glViewport(0, 0, width, height);
		gl.glMatrixMode(GL10.GL_PROJECTION);
		gl.glLoadIdentity();
if(height>width)
	GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.1f, 100.0f);
		else
	GLU.gluPerspective(gl, 45.0f, (float) height / (float) width, 0.1f, 100.0f);

		gl.glMatrixMode(GL10.GL_MODELVIEW); 	
		gl.glLoadIdentity(); 					
	}
 
开发者ID:karacken,项目名称:PlayLikeCurl,代码行数:18,代码来源:PageRenderer.java

示例3: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int width, int height) {
    gl.glViewport(0, 0, width, height);

    /*
     * Set our projection matrix. This doesn't have to be done each time we
     * draw, but usually a new projection needs to be set when the viewport
     * is resized.
     */
    float ratio = (float)width / height;
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();

    GLU.gluPerspective(gl, 60.0f, ratio, 2.0f, 3000.0f);

    mCameraDirty = true;  
}
 
开发者ID:tgmarinho,项目名称:apps-for-android,代码行数:17,代码来源:SimpleGLRenderer.java

示例4: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public final void onSurfaceChanged(GL10 gl, int width, int height) {
  // Camera.
  gl.glViewport(0, 0, width, height);
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glLoadIdentity();
  GLU.gluPerspective(gl, 90, (float) (width) / height, 1, 2 * VIEW_SIZE);
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glLoadIdentity();

  // GL configuration.
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
  gl.glEnable(GL10.GL_DEPTH_TEST);

  // Styles.
  gl.glClearColor(1, 1, 1, 1);
  gl.glLineWidth(10);
}
 
开发者ID:zhangjingpu,项目名称:youkes_vr,代码行数:20,代码来源:OrientationView.java

示例5: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
	if (height == 0)
		height = 1; // To prevent divide by zero
	float aspect = (float) width / height;

	// Set the viewport (display area) to cover the entire window
	gl.glViewport(0, 0, width, height);

	// Setup perspective projection, with aspect ratio matches viewport
	gl.glMatrixMode(GL10.GL_PROJECTION); // Select projection matrix
	gl.glLoadIdentity(); // Reset projection matrix
	// Use perspective projection
	GLU.gluPerspective(gl, 45, aspect, 0.1f, 100.f);

	gl.glMatrixMode(GL10.GL_MODELVIEW); // Select model-view matrix
	gl.glLoadIdentity(); // Reset

}
 
开发者ID:nwanvu,项目名称:OpenGL-3D-Example,代码行数:20,代码来源:MyGLRenderer.java

示例6: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
	float aspectRatio = (float) width / height;

	gl.glViewport(0, 0, width, height);
	
	gl.glLoadIdentity();
	gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

	if (stlObject != null) {
		Log.i("maxX:" + stlObject.maxX);
		Log.i("minX:" + stlObject.minX);
		Log.i("maxY:" + stlObject.maxY);
		Log.i("minY:" + stlObject.minY);
		Log.i("maxZ:" + stlObject.maxZ);
		Log.i("minZ:" + stlObject.minZ);
	}

	GLU.gluPerspective(gl, 45f, aspectRatio, 1f, 5000f);// (stlObject.maxZ - stlObject.minZ) * 10f + 100f);

	gl.glMatrixMode(GL10.GL_MODELVIEW);
	GLU.gluLookAt(gl, 0, 0, 100f, 0, 0, 0, 0, 1f, 0);
}
 
开发者ID:fastbot3d,项目名称:FastBot-Apk,代码行数:24,代码来源:STLRenderer.java

示例7: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(final GL10 gl, final int width, final int height) {
    gl.glViewport(0, 0, width, height);
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glLoadIdentity();
    GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, .1f, 100f);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glLoadIdentity();

    GLU.gluLookAt(gl,
            0, 1, 1,
            0, 0, 0,
            0, 1, 0
    );

}
 
开发者ID:mdellavo,项目名称:plasma,代码行数:18,代码来源:HeightMapRenderer.java

示例8: onDrawFrame

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 gl) {
	if(panorama != null) {
		gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        GLU.gluPerspective(gl, camera.getAdjustedFOV(), (float) width / (float) height, ZNEAR, ZFAR);
        gl.glMatrixMode(GL10.GL_MODELVIEW);
		
		gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
           gl.glLoadIdentity();
           
           float[] lookAt = camera.getLookAtVector();
        GLU.gluLookAt(gl, camera.getPositionX(), camera.getPositionY(), camera.getPositionZ(), lookAt[0], lookAt[1], lookAt[2], 0.0f, 1.0f, 0.0f);
           
        panorama.drawFrame(gl);
	}
}
 
开发者ID:murrple-1,项目名称:PanoEngine-Android,代码行数:18,代码来源:PanoramaRenderer.java

示例9: initGL

import android.opengl.GLU; //导入方法依赖的package包/类
public void initGL( ) {
    int width = sv.getWidth();
    int height = sv.getHeight();
    mGL.glViewport(0, 0, width, height);
    mGL.glMatrixMode(GL10.GL_PROJECTION);
    mGL.glLoadIdentity();
    float aspect = (float) width/height;
    GLU.gluPerspective(mGL, 45.0f, aspect, 1.0f, 30.0f);
     mGL.glClearColor(0.5f,0.5f,0.5f,1);
     
     // the only way to draw primitives with OpenGL ES
     mGL.glEnableClientState(GL10.GL_VERTEX_ARRAY);
     
     // some rendering options
     mGL.glShadeModel(GL10.GL_SMOOTH);
     mGL.glEnable(GL10.GL_DEPTH_TEST);
     //mGL.glEnable(GL10.GL_CULL_FACE);

    Log.i("GL", "GL initialized");
}
 
开发者ID:JimSeker,项目名称:opengl,代码行数:21,代码来源:BasicGLCube.java

示例10: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {

	if (height == 0) { // Prevent A Divide By Zero By
		height = 1; // Making Height Equal One
	}

	gl.glViewport(0, 0, width, height); // Reset The Current Viewport
	gl.glMatrixMode(GL10.GL_PROJECTION); // Select The Projection Matrix
	gl.glLoadIdentity(); // Reset The Projection Matrix

	// Calculate The Aspect Ratio Of The Window
	GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.1f,
			50000);
	// gl.glFrustumf(-4, 4, -4, 4, 3, 10);
	// gl.glFrustumf(-400, 400, -221, 221, 0.1f, 100);
	// gl.glOrthof(-10, 10, -50, 50, -10, 10);

	gl.glMatrixMode(GL10.GL_MODELVIEW); // Select The Modelview Matrix
	gl.glLoadIdentity();

	screenWidth = width;
	screenHeight = height;

}
 
开发者ID:mustafaneguib,项目名称:tag-augmented-reality-android,代码行数:26,代码来源:Browser.java

示例11: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int width, int height) {

        //sets the viewport size
        gl.glViewport(0, 0, width, height);  //WHOLE SCREEN
        viewwidth = width;
        viewheight = height;
        // Select the projection matrix
        gl.glMatrixMode(GL10.GL_PROJECTION);
        // Reset the projection matrix
        gl.glLoadIdentity();
        // Calculate the aspect ratio of the window
        GLU.gluPerspective(gl, 45.0f,
                (float) width / (float) height,
                0.1f, 100.0f);
        // Select the modelview matrix
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        // Reset the modelview matrix
        gl.glLoadIdentity();

    }
 
开发者ID:PhilipRead,项目名称:Codename-Slate,代码行数:21,代码来源:MyGLRenderer.java

示例12: present

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void present(float deltaTime) {
	// TODO Auto-generated method stub
	GL10 gl = glGraphics.getGL();
       gl.glViewport(0, 0, glGraphics.getWidth(), glGraphics.getHeight());
       gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
       gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
       gl.glClearDepthf(1.0f);
       gl.glMatrixMode(GL10.GL_PROJECTION);
       gl.glLoadIdentity();
       GLU.gluPerspective(gl, 45, 
                          glGraphics.getWidth() / (float) glGraphics.getHeight(),
                          0.1f, 1000.0f);
       gl.glMatrixMode(GL10.GL_MODELVIEW);
       gl.glLoadIdentity();
	for(int i=0; i<fireworkNum; i++)
	{
		fireworks[i].draw();
		fireworks[i].update(deltaTime);
	}
	
}
 
开发者ID:yzxsunshine,项目名称:SensorFusionPedometer,代码行数:23,代码来源:FireworkScreen.java

示例13: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {

	if (GLESVersion == 1) {

		if (height == 0) {
			height = 1;
		}

		glViewport(0, 0, width, height);
		glMatrixMode(GLES10.GL_PROJECTION);
		glLoadIdentity();

		GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.1f,
				1024.0f);

		glMatrixMode(GLES10.GL_MODELVIEW);
		glLoadIdentity();

	} else {
		onSurfaceChangedGLES20(width, height);
	}
}
 
开发者ID:TheFakeMontyOnTheRun,项目名称:derelict,代码行数:24,代码来源:GLESRenderer.java

示例14: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
public void onSurfaceChanged(GL10 gl, int width, int height) {
	gl.glViewport(0, 0, width, height);

	/*
	 * Set our projection matrix. This doesn't have to be done each time we
	 * draw, but usually a new projection needs to be set when the viewport
	 * is resized.
	 */
	float screenRatio = (float) width / height;
	gl.glMatrixMode(GL10.GL_PROJECTION);
	gl.glLoadIdentity();
	// gl.glFrustumf(-ratio, ratio, -1, 1, 1f, 100);

	GLU.gluPerspective(gl, 45.0f, screenRatio, 0.1f, Z_FAR);
	mWidth = width;
	mHeight = height;
	setupViewPort();
}
 
开发者ID:BeyondAR,项目名称:beyondar,代码行数:19,代码来源:ARRenderer.java

示例15: onSurfaceChanged

import android.opengl.GLU; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
	
	if(height == 0) { 						//Prevent A Divide By Zero By
		height = 1; 						//Making Height Equal One
	}

	gl.glViewport(0, 0, width, height); 	//Reset The Current Viewport
	gl.glMatrixMode(GL10.GL_PROJECTION); 	//Select The Projection Matrix
	gl.glLoadIdentity(); 					//Reset The Projection Matrix

	//Calculate The Aspect Ratio Of The Window
	GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f);

	gl.glMatrixMode(GL10.GL_MODELVIEW); 	//Select The Modelview Matrix
	gl.glLoadIdentity(); 					//Reset The Modelview Matrix
	GLU.gluLookAt(gl, mCamX,mCamY,mCamZ, mCamX,mCamY,0, 0,1,0);
	
	displayMarkers(gl);
}
 
开发者ID:BenjaminMesre,项目名称:UPMCarte,代码行数:24,代码来源:MapGLRenderer.java


注:本文中的android.opengl.GLU.gluPerspective方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。