OpenGL Programming Guide (Red Book)——坐标变换

OpenGL编程指南学习

Viewing

This chapter explains how to use OpenGL to accomplish these tasks: how to position and orient models in three-dimensional space and how to establish the location – also in three-dimensional space – of the viewpoint. All of these factors help determine exactly what image appears on the screen.

观测

在三维空间中如何放置模型、如何设定视点的位置,这些都决定了出现在屏幕上的图像。

You want to remember that the point of computer graphics is to create a two-dimensional image of three-dimensional objects (it has to be two-dimensional because it’s drawn on a flat screen), but you need to think in three-dimensional coordinates while making many of the decisions that determine what is drawn on the screen. A common mistake people make when creating three-dimensional graphics is to start thinking too soon that the final image appears on a flat, two-dimensional screen. Avoid thinking about which pixels need to be drawn, and instead try to visualize three-dimensional space. Create your models in some three-dimensional universe that lies deep inside your computer, and let the computer do its job of calculating which pixels to colour.

  虽然最后显示的是一个三维物体的二维图像,但是在你思考哪些部门会被显示在屏幕上是,应该是假设在三维坐标空间中思考。人们经常犯的一个错误就是,过早的去思考最后显示在二维平面屏幕上的最终显示图像,而不是思考那些像素会被绘制、三维空间如何被渲染。在计算机中假设在一个三维宇宙空间中创建模型,接着让计算机计算那些像素会被着色。

A series of three computer operations converts an object’s three-dimensional coordinates to pixel position on the screen:

·         Transformations, which are represented by matrix multiplication, include modelling, viewing, and projection operations. Such operations include rotation, translation, scaling, reflecting, orthographic projection, and perspective projection. Generally, you use a combination of several transformations to draw a scene.

·         Since the scene is rendered on a rectangular window, object (or parts of objects) that lie outside the window must be clipped. In three-dimensional computer graphics, clipping occurs by throwing out objects on one side of a clipping plane.

·         Finally, a correspondence must be established between the transformed coordinates and screen pixels. This is known as a viewport transformation.

三步一些列的计算机操作可以把物体的三维坐标转化为屏幕上的像素点。

·         转换——一般由矩阵乘法来表示。包含了旋转、位移、放大/缩小、反射、正交投影和透视投影。我们通常用的好几个转换的集合来绘制一个场景。

·         因为场景是被渲染到一个矩形窗口,所以不再窗口范围内的物体或者物体的一部分都将被剪切。在三维计算机图形学中,剪切通过把物体放到剪切面板的另一边来实现。

·         最后,需要建立一个转换坐标与屏幕像素的联系。这就是所谓的视口转换。

Overview The Camera Analogy

本章通过讲述摄像机拍照的原理来说明如何转换一个物体

The viewing transformations must precede the modelling transformations in your code, but you can specify the projection and viewport transformations at any point before drawing occurs.

视图转换必须先于建模转换。而投影和视口转换则可以在绘制之前的任何点执行。

Viewing->Modelling->Projection->Viewport

 

Viewing Transformation

视图观察变换

gluLookAt: the arguments for this command indicate where the camera (or eye position) is placed, where it is aimed, and which way is up.

安置摄像机,在OpenGL中用的gluLookAt,查查在OSG中是否有同样的要求

 

Modeling Transformation

建模转换

Use the modeling transformation to position and orient the model.

使用建模转化来设置模型的位置及朝向

 

Projection Transformation

投影转换

It is like choosing a lens for a camera.

You can think of this transformation as determining what the field of view or viewing volume is and therefore what objects are inside it and to some extent how they look. This is equivalent to choosing among wide-angle, normal, and telephoto lenses.

把这个转换视为决定视图区域或者视域的方法,因此什么物体会在这个范围之类并且进一步考虑他们的显示外观。这就像在广角、普通和长焦镜头之间的选择。

In addition to the field-of-view considerations, the projection transformation determines how objects are projected onto the screen, as the term suggests. (Perspective or Orthographic)

投影转移不仅决定了视图区域,同时,也将决定物体将如何呈现在屏幕上。(取决于采用透视投影还是正交投影)

 

Viewport Transformation

视口转换

Together, the projection transformation and the viewport transformation determine how a scene is mapped onto the computer screen. The projection transformation specifies the mechanics of how the mapping should occur, and the viewport indicates the shape of the available screen area into which the scene is mapped. Since the viewport specifies the region the image occupies on the computer screen, you can think of the viewport transformation as defining the size and location of the final processed photograph – for example, whether the photograph should be enlarged or shrunk.

投影转换及视口转换一起决定了场景是如何映射到计算机屏幕上的。投影转换设置了映射的出现过程,而视口则指出了可用的屏幕区域的外形。因为视口设置了图像在计算机屏幕上的区域,所以可以把视口转换当作设定最终图片的位置和大小——例如,图片是因该被放大或缩小。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值