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


Java GLU.gluLookAt方法代码示例

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


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

示例4: setLookAt

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void setLookAt(GL2 gl, GLU glu){
       double moved = 0;
       double location[] = ReadZBuffer.getOGLPos(gl, glu, width / 2, height / 2); //what you're moving towards
       if (mobile&&eyeX + dx > 0 && eyeZ + dz > 0 && eyeX + dx < 600 && eyeZ + dz < 600 && (eyeX + dx < 300 || eyeZ + dz < 500)) {
           if (Math.abs(location[0] - eyeX) > Math.abs(dx) + 1) {
               eyeX += dx;
               moved += dx;
           }//if you have room to move in the x direction, move in the x direction

           if (Math.abs(location[2] - eyeZ) > Math.abs(dz) + 1) {
               eyeZ += dz;
               moved += dz;
           }//ditto z
       }

       gl.glLoadIdentity();
       glu.gluLookAt(eyeX, eyeY, eyeZ,   // eye location
               eyeX + Math.cos(Math.toRadians(theta)) * Math.cos(Math.toRadians(gamma)), eyeY + Math.sin(Math.toRadians(gamma)), eyeZ + -Math.sin(Math.toRadians(theta)) * Math.cos(Math.toRadians(gamma)),   // point to look at (near middle of pyramid)
               0, 1, 0); // the "up" direction
       if (mobile&&(moved != 0 || qdown || edown || idown || kdown || dgamma != 0 || dtheta != 0)) {
       	notifyObservers();
       }
}
 
开发者ID:ProfAmesBC,项目名称:Game2013,代码行数:24,代码来源:PlayerMotion.java

示例5: 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

示例6: 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

示例7: cameraView

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
public void cameraView(GL gl, GLU glu)
{
	gl.glMatrixMode(GL.GL_MODELVIEW);
	gl.glLoadIdentity();

	// glu.gluLookAt(0, 100, 200,
	// 0, 0, 0,
	// 0, 1, 0);

	glu.gluLookAt(0, 100, 100, 0, 0, 0, 0, 1, 0);
}
 
开发者ID:iSchluff,项目名称:Wii-Gesture,代码行数:12,代码来源:GForceVis.java

示例8: display

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

	gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear
																	// the
																	// drawing
																	// area

	if (pick)
		startPicking(gl, mousePos.x, mousePos.y);

	gl.glLoadIdentity(); // Reset the current matrix to the "identity"

	glu.gluLookAt(camera.getPosX(), camera.getPosY(), camera.getPosZ(), camera.getViewX(), camera.getViewY(),
			camera.getViewZ(), camera.getUpX(), camera.getUpY(), camera.getUpZ());

	if (wireFrame) {
		gl.glPolygonMode(GL.GL_FRONT, GL2.GL_LINE);
	} else {
		gl.glPolygonMode(GL.GL_FRONT, GL2.GL_FILL);
	}

	gl.glRotatef(270, 1.0f, 0.0f, 0.0f);

	if (displayMap) {
		renderMap.display(gl);
	}
	if (displayWater){
		renderWater.display(gl);
	}
	if (displayCars) {
		renderCars.display(gl);
	}

	if (pick) {
		stopPicking(gl);
		pick = false;
	}

	if (takeScreen) {
		takeScreenshot(gl);
		takeScreen = false;
	}

	updateFPS();
}
 
开发者ID:ShadwLink,项目名称:Shadow-Mapper,代码行数:48,代码来源:glListener.java

示例9: GLDisplay

import javax.media.opengl.glu.GLU; //导入方法依赖的package包/类
private void GLDisplay(GLAutoDrawable glad) {
	
	GL gl = glad.getGL();
	
	if(scene.isUpdating()) {
		
		loadingTextures = true;
		
		ArrayList<String> newTextures = (loader).getNewTextures();
		
		for(int i = 0; i < newTextures.size(); i++)
			textureLoader.getTexture(newTextures.get(i));
		
		textureLoader.loadTextures(gl);
		
		loadingTextures = false;
		
		return;
	}
	
	GLU glu = new GLU();
	
	gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
	gl.glShadeModel(GL.GL_SMOOTH);
	
	gl.glMatrixMode(GL.GL_PROJECTION);
	gl.glLoadIdentity();
	
	glu.gluPerspective(
			camera.getFOV(),
			((float) renderer.getWidth() / (float) renderer.getHeight()),
			camera.getNearest(),
			camera.getFarthest());
	
	gl.glMatrixMode(GL.GL_MODELVIEW);
	gl.glLoadIdentity();
	
	glu.gluLookAt(
			0, 0, 0,
			0, 0, 1,
			0, 1, 0);
	
	try {
		render(gl);
	}
	
	catch(Exception exception) {
		exception.printStackTrace();
	}
	
	frame.updateCursor();
	
	clock.incrementFrameCount();
}
 
开发者ID:Library-of-Kaeon,项目名称:Library-of-Kaeon,代码行数:55,代码来源:Renderer.java


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