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


Java GLU.gluLookAt方法代码示例

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


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

示例1: changeSize

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
/**
 * Changes the size of the lwjgl window
 * @param w The new width of the lwjgl window
 * @param h The new height of the lwjgl window
 */
private void changeSize(float w, float h) {
    // Prevent a division by zero, when window is too short
    if (h == 0) {
        h = 1;
    }
    float wRatio = 1.0f * w / h;
    // Reset the coordinate system before modifying
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    // Set the viewport to be the entire window
    GL11.glViewport(0, 0, (int) w, (int) h);
    // Set the correct perspective.
    GLU.gluPerspective(45.0f, wRatio, (float) near, (float) far);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GLU.gluLookAt(camPos.x, camPos.y, camPos.z, // Position
            camPos.x + camDir.x, camPos.y + camDir.y, camPos.z + camDir.z, // Lookat
            camUp.x, camUp.y, camUp.z);               // Up-direction}
}
 
开发者ID:CallForSanity,项目名称:Gaalop,代码行数:25,代码来源:LwJglRenderingEngine.java

示例2: perFrameGL

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
public void perFrameGL()
{
	
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	glShadeModel(GL_SMOOTH);
	glMatrixMode(GL_PROJECTION);
	glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);
	glLoadIdentity();
	GLU.gluPerspective(50f, SX/ SY, 0.01f, 100f);
	GLU.gluLookAt(-10,0,0,0,0,0,0,0,0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glEnable(GL_DEPTH_TEST);
	
}
 
开发者ID:jediminer543,项目名称:JediUtil-Deprecated,代码行数:17,代码来源:Game.java

示例3: testLookAtMatrix

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
public static void testLookAtMatrix(Vector3f eye, Vector3f center, Vector3f up)
{
	// Make a lookat matrix in opengl and pull it out into a Matrix4f
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glLoadIdentity();
	GLU.gluLookAt(eye.x, eye.y, eye.z, center.x, center.y, center.z, up.x, up.y, up.z);
	
	FloatBuffer fromGlBuffer = BufferUtils.createFloatBuffer(16);
	GL11.glGetFloat(GL11.GL_MODELVIEW, fromGlBuffer);
	Matrix4f fromGl = new Matrix4f();
	fromGl.load(fromGlBuffer);
	
	Matrix4f manual = createLookAt(eye, center, up);
	
	compare(fromGl, manual);
}
 
开发者ID:tectonicus,项目名称:tectonicus,代码行数:17,代码来源:MatrixUtil.java

示例4: ProjectionMode

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
protected void ProjectionMode()
  {
	GL11.glEnable(GL11.GL_LIGHTING);
      GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();

GLU.gluPerspective(45.0f, (float) Display.getWidth()
		/ (float) Display.getHeight(), 0.1f, 900.0f);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GLU.gluLookAt(0, 20, 50, 0, -2, -100, 0, -1, 0);
  }
 
开发者ID:Glynn-Taylor,项目名称:Heightmap-Renderer,代码行数:12,代码来源:State.java

示例5: ProjectionMode

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
protected void ProjectionMode() {
	GL11.glEnable(GL11.GL_LIGHTING);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();

	GLU.gluPerspective(45.0f,
			(float) Display.getWidth() / (float) Display.getHeight(), 0.1f,
			600.0f);
	GLU.gluLookAt(0, 20, 50, 0, -2, -100, 0, -1, 0);
}
 
开发者ID:Glynn-Taylor,项目名称:9-Gates,代码行数:12,代码来源:State.java

示例6: run

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
@Override
public void run() {
    startEngine();
    //long start = System.currentTimeMillis();
    while (!Display.isCloseRequested()) {
        //System.out.println(System.currentTimeMillis()-start);
        //start = System.currentTimeMillis();
        
        if (rendering.isNewDataSetAvailable()) {
            if (list != -1) GL11.glDeleteLists(list, 1);
            list = GL11.glGenLists(1);
            GL11.glNewList(list, GL11.GL_COMPILE);
            draw(rendering.getDataSet(), rendering.getVisibleObjects(), rendering.getLoadedPointClouds());
            GL11.glEndList();
            changed = true;
        }
        
        
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // clear the screen
        GL11.glLoadIdentity(); // apply camPos before rotation

        GL11.glTranslatef(0.0f, 0.0f, -5.0f);
        // draw
        GLU.gluLookAt(camPos.x, camPos.y, camPos.z, // Position
                camPos.x + camDir.x, camPos.y + camDir.y, camPos.z + camDir.z, // Lookat
                camUp.x, camUp.y, camUp.z);               // Up-direction
        // apply rotation
        GL11.glRotatef(camAngleX, 0, 1, 0); // window x axis rotates around up vector
        GL11.glRotatef(camAngleY, 1, 0, 0); // window y axis rotates around x

        //Render the scene
        if (list != -1) GL11.glCallList(list);

        pollInput();
        Display.update();
        if (recorder != null) {
            if (changed || firstFrame) {
                recorder.makeScreenshot();
                changed = false;
            }
            firstFrame = false;
            Display.sync(25); // cap fps to 60fps
        }
        else 
            Display.sync(60); 
    }

    Display.destroy();
}
 
开发者ID:CallForSanity,项目名称:Gaalop,代码行数:50,代码来源:LwJglRenderingEngine.java

示例7: gluLookAt

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
public void gluLookAt(float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz) {
	GLU.gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:LwjglGL.java

示例8: repos

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
@Override
public void repos()
{
	GLU.gluLookAt(eye.x, eye.y, eye.z, lookAt.x, lookAt.y, lookAt.z, up.x, up.y, up.z);
}
 
开发者ID:jediminer543,项目名称:JediUtil-Deprecated,代码行数:6,代码来源:StaticCamera.java

示例9: Init

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
@Override
protected void Init() {
	if (CreateNewGame) {
		CurrentSave = new GameSave();
		Worlds = new TileMap[] { new TileMap(), new TileMap(),
				new TileMap(), new TileMap(), new TileMap(), new TileMap(),
				new TileMap(), new TileMap(), new TileMap() };
		t = Worlds[0];
		CreateGUI();
		System.out.println("Loading worlds");
		for (int i = 0; i < Worlds.length; i++) {
			Worlds[i].Load(i == Worlds.length - 1, i == 0, i);
			CurrentSave.setIntMapData(TileMapGenerator.Map, i);
		}
	}
	GL11.glEnable(GL11.GL_LIGHTING);
	GL11.glEnable(GL11.GL_LIGHT0);
	GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
	GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();

	GLU.gluPerspective(45.0f,
			(float) Display.getWidth() / (float) Display.getHeight(), 0.1f,
			600.0f);
	GLU.gluLookAt(0, 20, 50, 0, -2, -100, 0, -1, 0);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glLoadIdentity();
	if (CreateNewGame) {
		player = t.SpawnPlayer();
		PlayerGridX = player.getX();
		PlayerGridY = player.getY();
		PlayerY = 52 - CameraDisplacement * (PlayerGridY - 1);
		PlayerX = -6 + CameraDisplacement * (PlayerGridX - 1);
		PlayerZ = 0;
		SetGUI();
	}
	CreateNewGame = true;

	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
 
开发者ID:Glynn-Taylor,项目名称:9-Gates,代码行数:44,代码来源:State_SINGLEPLAYER.java

示例10: apply

import org.lwjgl.util.glu.GLU; //导入方法依赖的package包/类
void apply()
{
	GLU.gluLookAt(fromX, fromY, fromZ,  toX, toY, toZ,  upX, upY, upZ);
}
 
开发者ID:TheWhiteShadow3,项目名称:cuina,代码行数:5,代码来源:Camera.java


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