本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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);
}
示例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
}
示例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);
}
示例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
);
}
示例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);
}
}
示例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");
}
示例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;
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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);
}