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


Java GLU.gluPerspective方法代码示例

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


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

示例1: setCamera

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
private void setCamera(GL2 gl, GLU glu) 
{
	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glLoadIdentity();

	
	glu.gluPerspective(75, 1, 0.01, 1000);		
	//look at the player from 1.5 units directly above the player 
	glu.gluLookAt(
			inst.player.pos.x, inst.player.pos.y, 1.5, 
			inst.player.pos.x, inst.player.pos.y, 0,
			 0, 1, 0);

	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:ben-j-c,项目名称:TopDownGame,代码行数:17,代码来源:Display.java

示例2: setCamera

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
private void setCamera(GLAutoDrawable drawable, GLU glu, float distance) {
	GL2 gl = drawable.getGL().getGL2();

	// Change to projection matrix.
	gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
	gl.glLoadIdentity();
	//gl.glEnable(GL.GL_DEPTH_TEST);
	//gl.glTranslatef( 0f, 0f, 800);
	//gl.glTranslatef( chip.getSizeX()/2, chip.getSizeX()/2, chip.getSizeX()/2 );
	//gl.glRotatef(45, 0, 1, 0);

	// Perspective.
	float widthHeightRatio = getWidth() / getHeight();
	//glu.gluPerspective(60, widthHeightRatio, 200, 1200);
	glu.gluPerspective(60, widthHeightRatio, 50, 2000);
	glu.gluLookAt(xeye, yeye, distance, 0, 0, 0, 0, 1, 0);

	// Change back to model view matrix.
	gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
	gl.glLoadIdentity();

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:Triangulation3DViewer.java

示例3: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
    AWTGraphics3D g = (AWTGraphics3D) graphics;
    GL2 gl = g.getGL2(); // get the OpenGL graphics context
    GLU glu = g.getGLU();

    if (height == 0) height = 1;   // prevent divide by zero
    float aspect = (float) width / height;

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

    // Setup perspective projection, with aspect ratio matches viewport
    gl.glMatrixMode(GL2.GL_PROJECTION);  // choose projection matrix
    gl.glLoadIdentity();             // reset projection matrix

    glu.gluPerspective(45.0, aspect, 0.1, 100.0); // fovy, aspect, zNear, zFar

    // Enable the model-view transform
    gl.glMatrixMode(GL2.GL_MODELVIEW);
    gl.glLoadIdentity(); // reset
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:AnimationApplication.java

示例4: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2(); // get the OpenGL graphics context
	GLU glu = g.getGLU();

	if (height == 0) height = 1;   // prevent divide by zero
	float aspect = (float)width / height;

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

	// Setup perspective projection, with aspect ratio matches viewport
	gl.glMatrixMode(GL2.GL_PROJECTION);  // choose projection matrix
	gl.glLoadIdentity();             // reset projection matrix

	glu.gluPerspective(45.0, aspect, 0.1, 100.0); // fovy, aspect, zNear, zFar

	// Enable the model-view transform
	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity(); // reset
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:SimpleMeshExample.java

示例5: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
    AWTGraphics3D g = (AWTGraphics3D) graphics;
    GL2 gl = g.getGL2(); // get the OpenGL graphics context
    GLU glu = g.getGLU();

    if (height == 0) height = 1;   // prevent divide by zero
    float aspect = (float) width / height;

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

    // Setup perspective projection, with aspect ratio matches viewport
    gl.glMatrixMode(GL2.GL_PROJECTION);  // choose projection matrix
    gl.glLoadIdentity();             // reset projection matrix

    glu.gluPerspective(45.0, aspect, 0.1, 1000.0); // fovy, aspect, zNear, zFar

    // Enable the model-view transform
    gl.glMatrixMode(GL2.GL_MODELVIEW);
    gl.glLoadIdentity(); // reset
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:LogoShowApplication.java

示例6: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2(); // get the OpenGL graphics context
	GLU glu = g.getGLU();

	if (height == 0) height = 1;   // prevent divide by zero
	float aspect = (float)width / height;

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

	// Setup perspective projection, with aspect ratio matches viewport
	gl.glMatrixMode(GL2.GL_PROJECTION);  // choose projection matrix
	gl.glLoadIdentity();             // reset projection matrix

	double angle = 45;
	
	double nearDistance = 0.1;
	double farDistance = 100;
	
	glu.gluPerspective(angle, aspect, nearDistance, farDistance); // fovy, aspect, zNear, zFar
	
	frustrum.setCamInternals(angle, aspect, nearDistance, 1);
	frustrum.setCamDef(new Vector3(0, 1, 0.6f), new Vector3(0, 0, 0), new Vector3(0, 1, 0));

	// Enable the model-view transform
	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity(); // reset
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:31,代码来源:FrustrumRender.java

示例7: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
    GL2 gl = drawable.getGL().getGL2();

    if (g_imageWidth != width || g_imageHeight != height) {
        g_imageWidth = width;
        g_imageHeight = height;

        DeleteDualPeelingRenderTargets(gl);
        InitDualPeelingRenderTargets(gl);

        DeleteFrontPeelingRenderTargets(gl);
        InitFrontPeelingRenderTargets(gl);

        DeleteAccumulationRenderTargets(gl);
        InitAccumulationRenderTargets(gl);
    }

    gl.glMatrixMode(GL2.GL_PROJECTION);
    gl.glLoadIdentity();

    GLU glu = GLU.createGLU(gl);
    glu.gluPerspective(FOVY, (float) g_imageWidth / (float) g_imageHeight, ZNEAR, ZFAR);
    gl.glMatrixMode(GL2.GL_MODELVIEW);

    gl.glViewport(0, 0, g_imageWidth, g_imageHeight);

}
 
开发者ID:java-opengl-labs,项目名称:oit,代码行数:29,代码来源:DualDepthPeeling.java

示例8: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int w, int h) {
    AWTGraphics3D g = (AWTGraphics3D) graphics;
    GL2 gl = g.getGL2();
    GLU glu = g.getGLU();

    gl.glViewport(x, y, w, h);

    gl.glMatrixMode(GL2.GL_PROJECTION);

    gl.glLoadIdentity();

    glu.gluPerspective(60.0, (double) w / (double) h, 0.1, 500.0);

    gl.glMatrixMode(GL2.GL_MODELVIEW);

    gl.glLoadIdentity();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:19,代码来源:StampApplication.java

示例9: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	GLU glu = g.getGLU();

	gl.glViewport (x, y, width, height);

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

	float aspect = (float)width / (float)height; 

	glu.gluPerspective(60, aspect, 1, 100);

	gl.glMatrixMode(GL2.GL_MODELVIEW);

	gl.glLoadIdentity();

}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:22,代码来源:RotateAroundExample.java

示例10: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	GLU glu = g.getGLU();

	gl.glViewport((int)x, (int)y, (int)w, (int)h);

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

	glu.gluPerspective(60.0, (double) w / (double) h, 0.1, 500.0);

	gl.glMatrixMode(GL2.GL_MODELVIEW);

	gl.glLoadIdentity();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:19,代码来源:RotationAxis.java

示例11: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	GLU glu = g.getGLU();

	gl.glViewport (x, y, width, height);

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();
			
	float aspect = (float)width / (float)height; 
	
	glu.gluPerspective(60, aspect, 1, 100);

	gl.glMatrixMode(GL2.GL_MODELVIEW);

	gl.glLoadIdentity();

}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:22,代码来源:RadialMarkerApplication.java

示例12: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	GLU glu = g.getGLU();

	gl.glViewport((int)x, (int)y, (int)w, (int)h);

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

	glu.gluPerspective(60.0, (double) w / (double) h, 0.1, 500.0);

	gl.glMatrixMode(GL2.GL_MODELVIEW);

	gl.glLoadIdentity();

}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:20,代码来源:Perspective.java

示例13: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	GLU glu = g.getGLU();

	gl.glViewport((int)x, (int)y, (int)w, (int)h);

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

	glu.gluPerspective(60.0, (double) w / (double) h, 0.1, farPlane);

	gl.glMatrixMode(GL2.GL_MODELVIEW);

	gl.glLoadIdentity();

}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:20,代码来源:SkyboxExample.java

示例14: doSelectionRun

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
private void doSelectionRun(final GLAutoDrawable drawable) {
	GL2 gl = drawable.getGL().getGL2();
	GLU glu = GLU.createGLU();
	IntBuffer buffer = Buffers.newDirectIntBuffer(512);
	int hits, n, first = -1;
	float z, zmin = Float.POSITIVE_INFINITY;

	int[] viewport = new int[4];

	gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
	gl.glSelectBuffer(512, buffer);
	gl.glRenderMode(GL2.GL_SELECT);
	gl.glInitNames();

	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glPushMatrix();
	gl.glLoadIdentity();

	glu.gluPickMatrix(selX, viewport[3] - selY, 1.0, 1.0, viewport, 0);
	glu.gluPerspective(60.0, (float)viewport[2] / viewport[3], 1, 100000.0);

	// draw graph
	renderScene(drawable.getGL().getGL2());

	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glPopMatrix();
	gl.glFlush();

	hits = gl.glRenderMode(GL2.GL_RENDER);
	// log.info("Selection run, got " + hits + " hits!");

	for(int i = 0; i < hits; ++i) {
		n = buffer.get();
		z = (float) (buffer.get() & 0xffffffffL) / 0x7ffffff;
		buffer.get();

		// discard unnecessary stuff
		//buffer.position(buffer.position() + n);
		for(int j=0; j<n-1; ++j)
			buffer.get();

		n = buffer.get();
		if(z < zmin) {
			zmin = z;
			first = n;
		}
		log.info("Buffer: " + n + ", min distance: " + z);
	}
	synchronized (aCam) {
		aCam.selectedObj = objectNameMap.get(first);
		selectionRun = false;
		aCam.notify();
	}
}
 
开发者ID:trent2,项目名称:bGLOOP,代码行数:55,代码来源:GLRenderer.java

示例15: reshape

import com.jogamp.opengl.glu.GLU; //导入方法依赖的package包/类
/**
 * Called when the GL drawable has been resized
 *
 * @param gLAutoDrawable The drawable being used for rendering
 * @param x The new x coordinate of the drawable
 * @param y The new y coordinate of the drawable
 * @param w The new width of the drawable
 * @param h The new height of the drawable
 */
public void reshape(
    GLAutoDrawable gLAutoDrawable, int x, int y, int w, int h)
{
    final GL2 gl = (GL2)gLAutoDrawable.getGL();
    final GLU glu = new GLU();

    log.debug("Viewer GL reshape to: " + w + ", " + h);

    log.debug("OS NAME: " + System.getProperty("os.name"));
    log.debug("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR));
    log.debug("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER));
    log.debug("GL_VERSION: " + gl.glGetString(GL.GL_VERSION));

    System.out.println(gl);
    // allow for bug???? / unimplemented????? glDeleteList() on linux
    // nvidia driver.
    if (
        System.getProperty("os.name")
            .equals("Linux") &&
            gl.glGetString(GL.GL_VENDOR)
            .equals("NVIDIA Corporation"))
    {
        parameters.setDisableGLDeleteList(true);

        log.warn("NVIDIA/Linux: Display lists will not be freed if used.");
    }

    width = w;
    height = h;

    gl.glViewport(0, 0, w, h);
    gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
    gl.glLoadIdentity();

    double vAngle = 45.0;

    if (width <= height)
    {
        vAngle = (45.0 * height) / width;
    }

    // View angle is specified in vertical direction, but we need
    // to exaggerate it if image is taller than wide.
    final float viewAngleDegrees = (float) Math.min(90.0, vAngle);

    // Was 0.1 (too far); 0.001 gives artefacts
    glu.gluPerspective(
        viewAngleDegrees, (float) width / (float) height, 0.01, 10.0);

    gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);

    ((CameraJOGL)getCamera()).gl = gl;  // zzing hack because camera's context is wrong, can't find
                                        // where it was set
    
    getCamera()
        .setManagePerspective(false);
    getCamera()
        .on();

    // updateGL();
    // ?????
    canvas.repaint();

    log.debug("GL reshape complete");
}
 
开发者ID:madebyjeffrey,项目名称:TerraJ,代码行数:75,代码来源:TriangleMeshViewerDisplay.java


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