當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。