您似乎已經收到關於gluLookAt()參數的一些不良信息。從OpenGL的2.1 online documentation,參數應該如下:
eyeX, eyeY, eyeZ:
World coordinates of camera location
centerX, centerY, centerZ:
World coordinates of camera aimpoint (what it's looking at).
This point will be in the center of the resulting image, assuming
that it lies between the near & far clip planes.
upX, upY, upZ:
A vector (preferrably orthogonal to the line of sight) that specifies the
roll orientation of the camera (that is, which way is "up" in the image).
正如你所看到的,有俯仰,滾轉,偏航或沒有明確提及。
另外,默認情況下,如果我記得正確的話,攝像頭位於(0,0,-1)處 - 但這並不重要,因爲您幾乎總是會將模型視圖矩陣設置爲標識來調用gluLookAt。
ahhh -1 ...但是中心的含義是什麼?對不起,我真的很新的OpenGL – 2011-05-07 04:47:03
@ | Phantasm |:我試圖說清楚。這是相機正在看的地方。中心 - 眼睛因此是視線矢量。 – 2011-05-07 04:52:16
OpenGL中沒有攝像頭。期。在OpenGL中沒有攝像頭,沒有默認的攝像頭位置(0,0,-1)。實際發生的是,你有一個矩陣轉換世界空間中的座標,稱爲模型視圖。相機的任何運動也可以被看作是整個世界的相反運動。 gluLookAt在當前模型視圖上應用了這種相反的變換。因此,通常首先將模型視圖重置爲標識,這將在**原點**(0,0,0)處放置任何類型的相機。 – datenwolf 2011-05-07 08:22:34