gluPerspective 与 gluOrtho2D [英] gluPerspective vs. gluOrtho2D

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

问题描述

我查看了 MSDN 上关于这两个函数的文档.但是,我不完全理解这两个功能之间的区别,除了一个用于为 3D 设置相机视图,另一个用于为 2D 设置相机视图.如果能回答就太好了.提前感谢您的评论.

I have looked at the documentation on MSDN about these 2 functions. However, I don't exactly understand the difference between these 2 functions, other than one is for setting camera view for 3D, and the other one is for setting camera view for 2D. It would be great if it can be answered. Thanks in advance for comments.

推荐答案

正交投影基本上是没有透视的 3D 投影.从本质上讲,这意味着给定位置离观察者越远,它就越靠近投影中心.视角显然是相反的.由于您在投影后除以 w 的事实,这意味着具有较大 W 的值(在世界范围内距离投影中心更远的一个值)将出现"更靠近 w-divide 后的投影中心.正是这种透视投影和 w-divide 为我们提供了 3D 图形的深度感.

An orthographic projection is basically a 3D projection that does not have perspective. Essentially it means that a given position does not get closer to the centre of projection the further it gets from the viewer. Perspective is obviously the opposite. Due to the fact that you divide by w after projecting it means that a value with a larger W (One that is further from the centre of projection in world terms) will "appear" closer to the centre of projection post w-divide. It is this perspective projection and w-divide that gives us the sense of depth in 3D graphics.

如果您还记得在早期的数学课中画过一个立方体,您会记得如果将构成立方体末端的 2 个正方形中的每一个都画成相同的大小,那么立方体的后端看起来会更大.这是一个正投影.它看起来很奇怪,因为我们的眼睛习惯于用透视来看待事物.

If you recall drawing a cube in early maths lessons you will recall that if you draw each of the 2 squares that make up the end of the cube as the same size then the back end of the cube will look larger. This is an orthographic projection. It looks weird because our eyes are used to seeing things with perspective.

如果你缩小第二个正方形,那么你就会得到透视,从而得到透视投影.

IF you shrink that second square then you get perspective and hence the perspective projection.

维基百科有一些很好的图片展示了差异以及很好的解释.

Wikipedia has some good images demonstrating the difference as well as a good explanation.

平行(或正交)投影
透视(或 3D)投影
对透视的一般解释

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

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