gluLookAt 解释? [英] gluLookAt explanation?

查看:63
本文介绍了gluLookAt 解释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图理解gluLookAt,尤其是最后3个参数.

Trying to understand gluLookAt, especially the last 3 parameters.

谁能解释一下?

gluLookAt(camera[0], camera[1], camera[2], /* look from camera XYZ */ 
          0, 0, 0,  /* look at the origin */ 
          0, 1, 0); /* positive Y up vector */

  1. 正 Y 向上向量"究竟是什么意思?
  2. 是否可以将最后一个向上向量的 3 个参数全部设为 1,例如1, 1, 1 ?而且,如果可能的话,它到底是什么意思?
  3. 向上向量的值是否可能大于 1,例如2, 3, 4 ?

谢谢.

推荐答案

草图拯救!

你的形象有一个向上",可以与世界的向上分开.此图像中的蓝色窗口可以被认为是绘制图像的近平面":您的显示器(如果您愿意的话).如果您提供的只是眼点和点,则该窗口可以自由旋转.你需要给出一个额外的向上"方向来固定它.如果不是单位长度,OpenGL 将标准化您提供的向量.OpenGL 也会将其向下投影,使其与由 eyeat 定义的z"向量形成 90 度角(除非您给出一个向上"向量,即在完全与从eye"到at"的线相同的方向).一旦定义了in"(z)和up"(y)方向,就很容易计算右"或(x) 方向.

Your image has an 'up' to it that can be separate from the world's up. The blue window in this image can be thought of as the 'near-plane' that your imagery is drawn on: your monitor, if you will. If all you supply is the eye-point and the at-point, that window is free to spin around. You need to give an extra 'up' direction to pin it down. OpenGL will normalize the vector that you supply if it isn't unit length. OpenGL will also project it down so that it forms a 90 degree angle with the 'z' vector defined by eye and at (unless you give an 'up' vector that is in exactly the same direction as the line from 'eye' to 'at'). Once 'in' (z) and 'up' (y) directions are defined, it's easy to calculate the 'right' or (x) direction from those two.

在此图中,如果蓝色轴位于 y 方向,则提供的"向上向量为 (0,1,0).如果你给出 (1,1,1),它很可能会将图像旋转 45 度,因为这意味着蓝色窗口的顶部应该指向那个方向.因此,这个人的形象似乎是倾斜的(朝相反的方向).

In this figure, the 'supplied' up vector is (0,1,0) if the blue axis is in the y direction. If you were to give (1,1,1), it would most likely rotate the image by 45 degrees because that's saying that the top of the blue window should be pointed toward that direction. Consequently the image of the guy would appear to be tipped (in the opposite direction).

这篇关于gluLookAt 解释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆