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(经过后面几个章节的学习后,我们希望能给你提供这样的一个全局的基本认识)

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

东汉书院、等你来玩哦

相关内容

热门资讯

空调连续工作多久需要停机休息 空调连续工作的时间取决于多个因素,包括空调的型号、功率、使用环境和维护情况等。一般来说,空调可以连续...
空调哪个符号是除湿的 空调除湿功能通常用一个水滴形状的符号表示。不同品牌和型号的空调遥控器可能会有所差异,但一般来说,除湿...
格力空调多长时间加一次氟利昂 1、一般情况下,空调对氟利昂的使用量是非常小的,所以在空调使用了四年左右的时候再考虑加也没问题。2、...
空调用多长时间需要加氟一次 一般情况下是五年。当出现以下这几种情况时,空调才需要加氟。1、空调的室内机和室外机各有两个接口,当接...
格调生活·C标思享荟:卡萨帝在... 9月12日的郑州龙湖金融岛,夜风轻拂,灯光璀璨。“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑...
品牌价值破千亿、高端份额持续领... 9月12日,“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑州站”在郑州龙湖金融岛举办。2026...
空调主板坏了修800还是换新的 空调主板坏了是修还是换新,需要考虑多个因素,以下是一些建议:1. 维修成本:如果维修费用较低,比如 ...
空调开多久需要休息多长时间 问题:空调开多久需要休息多长时间回答:1、在使用空调的过程中,一般空调开7~8个小时左右需要休息2~...
中央空调多长时间清洗一次 1、一般空调开机前清洗一次即可,空调开机中间时段再清洗一次,空调关机时清洗一次,这样比较合理。2、空...
中央空调氟利昂多久加一次 看空调制热和制冷程度,很多人的观点认为氟利昂必须一年放一次,其实这个观点是错误的,理解上面有点偏差,...