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


Java GLU.gluPerspective方法代码示例

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


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

示例1: init

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void init(GLAutoDrawable drawable) {
	System.out.println("--init--");
	GL2 gl = drawable.getGL().getGL2();
	glu = new GLU();

	System.out.println("INIT GL IS: " + gl.getClass().getName());
	if (!bDoNurbs) {
		gl.glMap2f(GL2.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, ctlarray, 0);
	}
	gl.glEnable(GL2.GL_MAP2_VERTEX_3);
	gl.glEnable(GL2.GL_AUTO_NORMAL);
	gl.glMapGrid2f(20, 0.0f, 1.0f, 20, 0.0f, 1.0f);

	setupLighting(drawable, gl);
	float fovy=40.f;
	float aspect=1.f;
	float znear=1.f;
	float zfar=20f;
	glu.gluPerspective(fovy, aspect, znear, zfar);

	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity();
	glu.gluLookAt(cameraLoc.x, cameraLoc.y, cameraLoc.z,
			lookAtPt.x, lookAtPt.y, lookAtPt.z,
			cameraUpDirection.x, cameraUpDirection.y, cameraUpDirection.z);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:27,代码来源:SurfaceTest.java

示例2: setView

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void setView(GL2 gl, GLU glu, GlobalState gs) {
    // Select part of window.
    gl.glViewport(0, 0, gs.w, gs.h);
    // Set projection matrix.
    gl.glMatrixMode(GL_PROJECTION);
    //Load the identity matrix.
    gl.glLoadIdentity();
    glu.gluPerspective(fovAngle, (float) gs.w / gs.h, planeNear, planeFar);
    // Set camera.
    gl.glMatrixMode(GL_MODELVIEW);
    //Load the identity matrix.
    gl.glLoadIdentity();
    glu.gluLookAt(eye.x(), eye.y(), eye.z(),
            center.x(), center.y(), center.z(),
            up.x(), up.y(), up.z());
}
 
开发者ID:ABoschman,项目名称:2IV60_RobotRace,代码行数:17,代码来源:CameraMode.java

示例3: reshape

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
/**
 * Reshape method
 */
public void reshape(GLAutoDrawable GLAutoDrawable, int x, int y, int width, int height)
{
	final GL gl = GLAutoDrawable.getGL();
	final GLU glu = new GLU();
	
	if(height <= 0) height = 1;
	
	//set the viewport
	gl.glViewport(0, 0, width, height);
	
	gl.glMatrixMode(GL.GL_PROJECTION);
	gl.glLoadIdentity();
	glu.gluPerspective(
			60.0,								// fov
			(float)width / (float)height,		// aspect
			0.1,								// near
			500.0								// far
	);
	
	gl.glMatrixMode(GL.GL_MODELVIEW);							//select The Modelview Matrix
	gl.glLoadIdentity();										//set the ModalView matrix to identity
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:26,代码来源:Demo3D.java

示例4: set

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void set(GL2 g, MapPanel panel) {
    int width = panel.getWidth();
    int height = panel.getHeight();
    
    GLU glu = GLU.createGLU(g);
    
    g.glViewport(0, 0, width, height);
    g.glMatrixMode(GL2.GL_PROJECTION);
    g.glLoadIdentity();
    float fwidth = width;
    float fheight = height;
    glu.gluPerspective(70, fwidth / fheight, 0.1f, 600.0f);
    g.glMatrixMode(GL2.GL_MODELVIEW);
    g.glLoadIdentity();
    glu.gluLookAt((float) posx, (float) posy, (float) posz, (float) posx + dirx, (float) posy + diry, (float) posz + dirz, 0, 1, 0);
    g.glMultMatrixf(matrix);
}
 
开发者ID:Warlander,项目名称:DeedPlanner-2,代码行数:18,代码来源:FPPCamera.java

示例5: reshape

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
/**
  * If the window is changed, reshaped or moved this will be called
  * and resets the variables that is affected to fit the new
  * screen size
  * @param drawable the current drawable object sent from JOGL
  * @param x the new x value sent from JOGL
  * @param y the new y value sent from JOGL
  * @param width the new width value sent from JOGL
  * @param height the new height value sent from JOGL
  */
@Override
 public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
	System.out.println("Viewer recieved order to reshape canvas to: x="+x+", y="+y+", w="+width+", h="+height);
   final GL gl = drawable.getGL();
   final GLU glu = new GLU();
   if (height <= 0) height = 1;
   final float ratio = (float)width / (float)height;
   gl.glViewport(0, 0, width, height);
   gl.glMatrixMode(GL.GL_PROJECTION);
   gl.glLoadIdentity();
   glu.gluPerspective(45.0f, ratio, 1.0, 1000.0);
   gl.glMatrixMode(GL.GL_MODELVIEW);
   gl.glLoadIdentity();
	System.out.println("Viewer completed reshape without any trouble");
 }
 
开发者ID:davidsundelius,项目名称:Muloks,代码行数:26,代码来源:Viewer.java

示例6: reshape

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

	if (height <= 0) { // avoid a divide by zero error!

		height = 1;
	}
	final float h = (float) width / (float) height;
	gl.glViewport(0, 0, width, height);
	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glLoadIdentity();
	glu.gluPerspective(45.0f, h, 0.1, 1000.0);
	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:ShadwLink,项目名称:Shadow-Mapper,代码行数:17,代码来源:glListener.java

示例7: startPicking

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void startPicking(GL2 gl, int mouseX, int mouseY) {
	GLU glu = new GLU();
	int viewport[] = new int[4];
	float ratio;

	gl.glSelectBuffer(512, selectBuffer);

	gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);

	gl.glRenderMode(gl.GL_SELECT);

	gl.glInitNames();

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

	glu.gluPickMatrix(mouseX, viewport[3] - mouseY, 5, 5, viewport, 0);
	ratio = (float) (viewport[2] + 0.0) / viewport[3];
	glu.gluPerspective(45, ratio, 0.1, 1000);
	gl.glMatrixMode(gl.GL_MODELVIEW);
}
 
开发者ID:ShadwLink,项目名称:Shadow-Mapper,代码行数:23,代码来源:glListener.java

示例8: setCamera

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
private void setCamera(GL2 gl, GLU glu, float width, float height) {

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

		// float dist = state.getZoom() / 100f;

		// perspective
		float widthHeightRatio = width / height;
		glu.gluPerspective(45, widthHeightRatio, 1, 1000);
		glu.gluLookAt(0, 0, CAMERA_DISTANCE, 0, 0, 0, 0, 1, 0);

		gl.glMatrixMode(GL2.GL_MODELVIEW);
		gl.glLoadIdentity();
	}
 
开发者ID:johb,项目名称:GAIA,代码行数:16,代码来源:Mode3D.java

示例9: reshape

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void reshape(GLAutoDrawable glAutoDrawable, int x, int y, int width, int height) {
    GL2 gl2 = glAutoDrawable.getGL().getGL2();
    gl2.glMatrixMode(GL2.GL_PROJECTION);
    gl2.glLoadIdentity();

    GLU glu = new GLU();
    float aspect = (float) width / (float) height;
    glu.gluPerspective(45, aspect, 0.0001f, 20f);
    gl2.glMatrixMode(GL2.GL_MODELVIEW);
    gl2.glLoadIdentity();
    viewWidth = width;
    viewHeight = height;
}
 
开发者ID:jlaw90,项目名称:Grimja,代码行数:14,代码来源:ModelRenderer.java

示例10: init

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void init(GLAutoDrawable drawable) {
	GL2 gl = drawable.getGL().getGL2();
	// Global settings.
	gl.glEnable(GL2.GL_DEPTH_TEST);
	gl.glDepthFunc(GL2.GL_LEQUAL);
	gl.glEnable(GL2.GL_POINT_SMOOTH);
	gl.glEnable(GL2.GL_LINE_SMOOTH);
	gl.glEnable(GL2.GL_FOG);
	gl.glEnable(GL2.GL_DITHER);
	gl.glHint(GL2.GL_FOG_HINT, GL2.GL_NICEST);

	gl.glColor3d(0, 0, 0);
	glut = new GLUT();

	// We want a nice perspective.
	// Create GLU.
	glu = new GLU();
	// Change to projection matrix.
	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glLoadIdentity();

	// Perspective.
	glu.gluPerspective(45, 1, 1, 100);
	glu.gluLookAt(2.3, 0.5, 1.8, 0.5, 0.5, 0.5, 0, 1, 0);

	// Change back to model view matrix.
	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:ryft,项目名称:NetVis,代码行数:31,代码来源:MulticubeVisualisation.java

示例11: init

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void init(GLAutoDrawable drawable)
{

	GL gl = drawable.getGL();
	GLU glu = new GLU();

	gl.glViewport(0, 0, 800, 600);

	gl.glMatrixMode(GL.GL_PROJECTION);
	gl.glLoadIdentity();
	float aspectRatio = (float) 800 / 600;
	glu.gluPerspective(45, aspectRatio, 0.1f, 500);

	/*
	 * gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity();
	 * 
	 * 
	 * glu.gluLookAt(0, 0, -500, 0, 0, 0, 0, 1, 0);
	 */
	cameraView(gl, glu);

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

	gl.glEnable(GL.GL_DEPTH_TEST);
	gl.glEnable(GL.GL_LINE_SMOOTH);
	gl.glEnable(GL.GL_BLEND);
	gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
	gl.glLineWidth(3.0f);
	gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

	rl = new RenderLoop(this);
	rl.start();
}
 
开发者ID:iSchluff,项目名称:Wii-Gesture,代码行数:35,代码来源:GForceVis.java

示例12: reshape

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D drawable, int x, int y, int width, int height) {

	GL2 gl = drawable.getGL2();
	GLU glu = drawable.getGLU();

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

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

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

	glu.gluPerspective(60 * zoom, aspect, 1, 100);
}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:17,代码来源:RemoteEnvironment.java

示例13: reshape

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D drawable, int x, int y, int width, int height) {

	GL2 gl = drawable.getGL2();
	GLU glu = drawable.getGLU();

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

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

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

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

}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:18,代码来源:SportsEnvironment.java

示例14: reshape

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D drawable, int x, int y, int width, int height) {

	GL2 gl = drawable.getGL2();
	GLU glu = drawable.getGLU();

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

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

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

	glu.gluPerspective(60 * zoom, aspect, 1, 10000);

}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:18,代码来源:BeachEnvironment.java

示例15: reshape

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D drawable, int x, int y, int width, int height) {

	GL2 gl = drawable.getGL2();
	GLU glu = drawable.getGLU();

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

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

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

	glu.gluPerspective(60 * zoom, aspect, 1, 100000);
}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:17,代码来源:DEMView.java


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