Primitives, Pipelines, and Pixels(图元、渲染管线与像素)

周一到周五,每天一篇,北京时间早上7点准时更新~,中英文对照,一边学编程一边弹吉他,做一个奇葩码农!

请不要怀疑翻译是否有问题,我们的翻译工程师是蓝翔毕业的呢!

对于书本内容,我们不做任何优化,任何新手无法实现课程效果或者看起来有困难,请吐槽原书作者!

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

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

东汉书院、等你来玩哦

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值