reading note of Opengl Programming Guide --part 5.

1.Describing Points, Lines, and Polygons

描述点,线和多边形

OpenGL works in the homogeneous coordinates of three-dimensional projective geometry, so for internal calculations, all vertices are represented with four floating-point coordinates (x, y, z, w). If w is different from zero, these coordinates correspond to the Euclidean, three-dimensional point (x/w, y/w,z/w).

Opengl 使用三维投影几何学中的齐次坐标系。因此在内部运算中,所有的顶点都被表示成四个浮点坐标(x,y,z,w)如果w不等于0,这些坐标对应于欧几里得坐标系中的(x/w, y/w,z/w

Polygons are typically drawn with the pixels in the interior filled in, but you can also draw them as outlines or a set of points.

多边形通常填充其内部像素。但你也可以绘制成轮廓或一组点。

In general, polygons can be complicated, so OpenGL imposes some strong restrictions on what constitutes a primitive polygon. First, the edges of OpenGL polygons can’t intersect.Second, OpenGL polygons must be convex, meaning that they cannot have indentations.Stated precisely, a region is convex if, given any two points in the interior, the line segment joining them is also in the interior.

一般来说,多边形可以很复杂。因此opengl对基本多边形的组成强加一些严格的限制。首先,opengl中多边形的边不能相交,其次,opengl中的多边形必须是凸的,意味着不能有缺口。准确来说,如果连接任意两个顶点之间的线段都位于多边形内部,那么这个多边形就是凸的。

Note that polygons with holes can’t be described. They are nonconvex, and they can’t be drawn with a boundary made up of a single closed loop.

注意,有洞的多边形无法被描绘出来,它们不是凸的,无法通过一条闭合的环来绘制。

Many real-world surfaces consist of nonsimple polygons, nonconvex polygons,or polygons with holes. Since all such polygons can be formed from unions of simple convex polygons, some routines to build more complex objects are provided in the GLU library. These routines take complex descriptions and tessellate them, or break them down into groups of the simpler OpenGL polygons that can then be rendered.

现实世界很多表面都是由非简单多边形,非凸多边形或有洞的多边形构成的。因此所有的多边形都能够从多个简单的凸多边形构成。GLUT库定义了多个建立复杂物体的函数。这些函数接受复杂的描述信息,并对它们进行网格化,将它们分解成可以被渲染的简单的opengl多边形。

Since OpenGL vertices are always three-dimensional, the points forming the boundary of a particular polygon don’t necessarily lie on the same plane in space.If a polygon’s vertices don’t lie in the same plane, then after various rotations in space, changes in the viewpoint, and projection onto the display screen, the points might no longer form a simple convex polygon.

因为Opengl顶点经常是三维的,因此由这些点构成的多边形的边界不一定总是共面的。如果一个多边形顶点并不在同一个平面上,接下来在空间不同的旋转变换视窗,并投影到屏幕上,这些点可能不再构成一个简单的凸多边形。

Some vertex array commands, such as glEnableClientState() and glVertexPointer(), when called between glBegin() and glEnd(), have undefined behavior but do not necessarily generate an error. (Also, routines related to OpenGL, such as glX*() routines, have undefined behavior between glBegin() and glEnd().) These cases should be avoided, and debugging them may be more difficult.

一些顶点数组的操作,比如glEnableClientState()或glVertexPointer(),当在glBegin()和glEnd()之间被调用的时候,将产生未定义行为但不一定会报错。(类似的,和opengl有关的函数比如glX*()函数,在glBegin()和glEnd()之间调用也会产生未定义行为)这些情况应该避免,调试这些错误非常困难。

Unless they are being compiled into a display list, all glVertex*() commands should appear between a glBegin() and glEnd() combination. (If they appear elsewhere, they don’t accomplish anything.) If they appear in a display list, they are executed only if they appear between a glBegin() and a glEnd().

除非被加到显示列表之中,否则所有的glVertex*()命令都必须在glBegin()和glEnd()之间。(如果他们出现在别的地方,他们不会完成任何操作)如果他们出现在显示列表中,当且仅当他们位于glBegin()和glEnd()之间会被执行。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值