本文整理匯總了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}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例10: apply
import org.lwjgl.util.glu.GLU; //導入方法依賴的package包/類
void apply()
{
GLU.gluLookAt(fromX, fromY, fromZ, toX, toY, toZ, upX, upY, upZ);
}