Primitives, Pipelines, and Pixels(图元、渲染管线与像素)
admin
2023-02-11 09:20:05
0

As discussed, the model followed by OpenGL is that of a production line, or pipeline. Data flow within this model is generally one way, with data formed from commands called by your programs entering the front of the pipeline and flowing from stage to stage until it reaches the end of the pipeline(就想之前提到过得那些OpenGL的模型,它就像是流水线作业一样,数据在这个模型里从你的应用程序流进了流水线,然后经历了一个一个的处理阶段后,最终抵达流水线的结尾). Along the way, shaders or other fixedfunction blocks within the pipeline may pick up more data from buffers or textures, which are structures designed to store information that will be used during rendering.(在整个流水线处理的过程中,shader们和那些固定功能的部分会从缓冲区里取出有用的数据,用于渲染) Some stages in the pipeline may even save data into these buffers or textures(其中某些处理过程甚至可以往缓冲区里存放数据), allowing the application to read or save the data(这样一来应用程序既可以往缓冲区里写数据,也可以从缓冲区里读数据), or even permitting feedback to occur(甚至可以把数据从显卡回传到CPU的内存上)

The fundamental unit of rendering in OpenGL is known as the primitive(在OpenGL中最小的被渲染的基本单位是图元). OpenGL supports many types of primitives(OpenGL支持很多种图元), but the three basic renderable primitive types are points, lines, and triangles(这些图元就包括点、线、三角形等等). Everything you see rendered on the screen is a collection of (perhaps cleverly colored) points, lines, and triangles(一切你在画面上看到的东西都是由这些玩意组成). Applications will normally break complex surfaces into a very large number of triangles and send them to OpenGL(应用程序可以把复杂的东西干成一个个图元,并最终渲染出来), where they are rendered using a hardware accelerator called a rasterizer(最终这些图元会被硬件加速器中一个加光栅化的东西渲染,光栅化是直译英文,姑且这么记着就可以). Triangles are, relatively speaking, pretty easy to draw(相对来说,三角形是更容易绘制的). As polygons, triangles are always convex,so filling rules are easy to devise and follow(因为三角形永远是凸多边形). Concave polygons can always be broken down into two or more triangles(那些凹多边形可以被分解成多个三角形), so hardware natively supports rendering triangles directly and relies on other subsystems4 to break complex geometry into triangles(所以硬件一般都只支持绘制三角形,如果不是三角形,则需要其他辅助系统将这些图形转换成三角形,所以你画三角形效率是最好的). The rasterizer is dedicated hardware that converts the three-dimensional representation of a triangle into a series of pixels that need to be drawn onto the screen(光栅化这个操作主要是相关的硬件把你的三维数据表达成一堆二维像素点的过程)

Points, lines, and triangles are formed from collections of one, two, or three vertices, respectively(点、线、三角形分别由1、2、3个点构成). A vertex is simply a point within a coordinate space(一个顶点简单的可以指某个坐标系中的位置). In our case, we primarily consider a three-dimensional coordinate system(在我们的书本中,我们主要指的是三位坐标系). The graphics pipeline is broken down into two major parts(图形管线主要包含2个部分). The first part, often known as the front end,(第一部分就是常常人们所说的前端,但是我们不清楚常常是谁?有谁知道的话可以打电话给美国总统一下) processes vertices and primitives(处理顶点和图元), eventually forming them into the points, lines, and triangles that will be handed off to the rasterizer(直接把他们变成点、线、三角形这些光栅器能够直接处理的数据). This is known as primitive assembly(这就是传说中的图元的处理). After going through the rasterizer, the geometry has been converted from what is essentially a vector representation into a large number of independent pixels(在经过光栅器处理后,所有的几何数据都变成了各自独立的像素点). These are handed off to the back end(这些是被后端处理的,实际上就是指的显卡,在OpenGL中非得说你是个前端程序员,显卡是后端程序员,法克), which includes depth and stencil testing, fragment shading, blending, and updating of the output image(显卡处理的时候还会包含神马深度测试、蒙版测试、着色、混合、更新输出的画面)

As you progress through this book, you will see how to tell OpenGL to start working for you(随着你慢慢的深入,你将知道如何告诉OpenGL开始干活). We’ll go over how to create buffers and textures and hook them up to your programs(我们将教会兄弟们如何创建缓冲区、纹理对象,并且让他们能够在你的程序中被玩弄). We’ll also see how to write shaders to process your data and how to configure the fixed-function blocks of OpenGL to do what you want(我们也会教你们如何写shader以及如何去配置那些不让我们写shader的固定功能的部分). OpenGL is really a large collection of fairly simple concepts(OpenGL真的是一个非常庞大的相当简单的概念), built upon each other. Having a good foundation and a big-picture view of the system is essential(对OpenGL有一个总体的认识是基本的), and over the next few chapters, we hope to provide that to you(经过后面几个章节的学习后,我们希望能给你提供这样的一个全局的基本认识)

第一时间获取最新桥段,请关注东汉书院以及图形之心公众号

东汉书院、等你来玩哦

相关内容

热门资讯

玩家攻略科普“决战卡五星.怎么... 有 亲,根据资深记者爆料决战卡五星是可以开挂的,确实有挂(咨询软件无需打...
终于懂了“神殿娱乐.开挂器?”... 家人们!今天小编来为大家解答神殿娱乐透视挂怎么安装这个问题咨询软件客服徽9752949的挂在哪里买很...
玩家攻略科普“YY棋牌.开挂神... 家人们!今天小编来为大家解答YY棋牌透视挂怎么安装这个问题咨询软件客服徽9784099的挂在哪里买很...
我来教教您“微竞棋牌.怎么开挂... 网上科普关于“微竞棋牌有没有挂”话题很是火热,小编也是针对微竞棋牌作*弊开挂的方法以及开挂对应的知识...
今日重大消息“新圣游炸金花.是... 您好:新圣游炸金花这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9752949】很多玩家在这款...
玩家分享攻略“同城游跑胡子.辅... 网上科普关于“同城游跑胡子有没有挂”话题很是火热,小编也是针对同城游跑胡子作*弊开挂的方法以及开挂对...
蓝白阵营联合提案“弹劾”赖清德... 中国台湾网12月21日讯 台湾地区民意机构中国国民党党团和台湾民众党党团(蓝白阵营)19日在台北举行...
最新引进“全民牛牛.辅助器?”... 您好:全民牛牛这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9784099】很多玩家在这款游戏...
旧金山假日季惊魂:大规模停电波... 当地时间20日,美国加利福尼亚州旧金山市发生大规模停电事故,影响约13万家庭和商户,繁忙的假日购物季...
最新引进“,17麻将.真的有挂... 家人们!今天小编来为大家解答,17麻将透视挂怎么安装这个问题咨询软件客服徽9784099的挂在哪里买...