C++ OpenGL gluLookAt 帮助

发布于 2024-11-05 18:18:02 字数 286 浏览 0 评论 0原文

我一直在尝试使用 gluLookAt 但遇到了一些问题...我的第一个问题是相机的默认位置是什么,每当我尝试使用它时,我的整个场景似乎横向和向上旋转... 我的第二个问题是......从我读到的内容来看,它是 gluLookAt(Posx,Posy,PosZ,yaw,pitch,roll,then 3 up 矢量),

但是偏航俯仰和滚动应该是什么顺序?

已解决
相机的默认位置为 gluLookAt(0, 0, 0, 0, 0,-1, 0, 1, 0); 感谢德鲁的所有帮助:D

I have been attempting to use gluLookAt but i have come across some issues...my first is what is the default position of the camera, whenever i try to use it, my whole scene seems to rotate sideways and up....
my second question is....from what i have read it is gluLookAt(Posx,Posy,PosZ,yaw,pitch,roll,then three up vectors)

but what order is yaw pitch and roll suppose to be in?

Solved
the default position of the camera is at gluLookAt(0, 0, 0, 0, 0,-1, 0, 1, 0);
Thanks Drew for all your help :D

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

养猫人 2024-11-12 18:18:02

您似乎获得了有关 gluLookAt() 参数的一些错误信息。从 OpenGL 2.1 在线文档中,参数应如下所示:

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 并将模型视图矩阵设置为恒等式。

You seem to have gotten some bad information about the arguments to gluLookAt(). From the OpenGL 2.1 online documentation, the arguments should be as follows:

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).

As you can see, there is no explicit mention of pitch, roll, or yaw.

Also, by default, the camera is at (0, 0, -1) if I recall correctly--but it doesn't matter since you'll almost always call gluLookAt with the modelview matrix set to the identity.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文