




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Opengl固定渲染管线操作顺序标签:primitivematrixassemblyvectorcolorsprocessing2012-04-15 22:421366人阅读评论(0)收藏举报分类:opengl(1)1234http:/fly.cc.fer.hr/unreal/theredbook/appendixa.html567This guide describes all the operations performed between the time vertices8are specified and when fragments are finally written into the framebuffer. The9chapters of this guide are arranged in an order that facilitates learning10rather than in the exact order in which these operations are actually11performed. Sometimes the exact order of operations doesnt matter - for12example, surfaces can be converted to polygons and then transformed, or13transformed first and then converted to polygons, with identical results - and14different implementations of OpenGL might do things differently. This appendix15describes a possible order; any implementation is required to give equivalent16results. If you want more details than are presented here, see the OpenGL17Reference Manual.181920This appendix has the following major sections:2122Overview23Geometric Operations24Pixel Operations25Fragment Operations26Odds and Ends27281. Overview2930This section gives an overview of the order of operations, as shown in Figure31A-1 . Geometric data(vertices, lines, and polygons)follows the path through32the row of boxes that includes evaluators and per-vertex operations, while33pixel data(pixels, images, and bitmaps)is treated differently for part of34the process. Both types of data undergo the rasterization and per-fragment35operations before the final pixel data is written into the framebuffer.3637IMAGE3839Figure A-1 : Order of Operations40414243All data, whether it describes geometry or pixels, can be saved in a display44list or processed immediately. When a display list is executed, the data is45sent from the display list just as if it were sent by the application.4647All geometric primitives are eventually described by vertices. If evaluators48are used, that data is converted to vertices and treated as vertices from then49on. Per-vertex calculations are performed on each vertex, followed by50rasterization to fragments. For pixel data, pixel operations are performed,51and the results are either stored in the texture memory, used for polygon52stippling, or rasterized to fragments.5354Finally, the fragments are subjected to a series of per-fragment operations,55after which the final pixel values are drawn into the framebuffer.56572. Geometric Operations5859Geometric data, whether it comes from a display list, an evaluator, the60vertices of a rectangle, or as raw data, consists of a set of vertices and the61type of primitive it describes(a vertex, line, or polygon). Vertex data62includes not only the(x, y, z, w)coordinates, but also a normal vector,63texture coordinates, a color or index, and edge-flag data. All these elements64except the vertexs coordinates can be specified in any order, and default65values exist as well.As soon as the vertex command glVertex*() is issued, the66components are padded, if necessary, to four dimensions(using z = 0 and w =671), and the current values of all the elements are associated with the vertex.68The complete set of vertex data is then processed.69703. Per-Vertex Operations7172In the per-vertex operations stage of processing, each vertexs spatial73coordinates are transformed by the modelview matrix, while the normal vector74is transformed by that matrixs inverse and renormalized if specified. If75automatic texture generation is enabled, new texture coordinates are generated76from the transformed vertex coordinates, and they replace the vertexs old77texture coordinates. The texture coordinates are then transformed by the78current texture matrix and passed on to the primitive assembly step.7980Meanwhile, the lighting calculations, if enabled, are performed using the81transformed vertex and normal vector coordinates, and the current material,82lights, and lighting model. These calculations generate new colors or indices83that are clamped or masked to the appropriate range and passed on to the84primitive assembly step.85864. Primitive Assembly8788Primitive assembly differs, depending on whether the primitive is a point, a89line, or a polygon. If flat shading is enabled, the colors or indices of all90the vertices in a line or polygon are set to the same value. If special91clipping planes are defined and enabled, theyre used to clip primitives of92all three types.(The clipping-plane equations are transformed by the inverse93of the modelview matrix when theyre specified.)Point clipping simply passes94or rejects vertices; line or polygon clipping can add additional vertices95depending on how the line or polygon is clipped. After this clipping, the96spatial coordinates of each vertex are transformed by the projection matrix,97and the results are clipped against the standard viewing planes x = w, y = 98w, and z = w.99100If selection is enabled, any primitive not eliminated by clipping generates a101selection-hit report, and no further processing is performed. Without102selection, perspective division by w occurs and the viewport and depth-range103operations are applied. Also, if the primitive is a polygon, its then104subjected to a culling test(if culling is enabled). A polygon might convert105to vertices or lines, depending on the polygon mode.106107Finally, points, lines, and polygons are rasterized to fragments, taking into108account polygon or line stipples, line width, and point size. Rasterization109involves determining which squares of an integer grid in window coordinates110are occupied by the primitive. Color and depth values are also assigned to111each such square.1121135. Pixel Operations114115Pixels from host memory are first unpacked into the proper number of116components. The OpenGL unpacking facility handles a number of different117formats. Next, the data is scaled, biased, and processed using a pixel map.118The results are clamped to an appropriate range depending on the data type,119and then either written in the texture memory for use in texture mapping or120rasterized to fragments.121122If pixel data is read from the framebuffer, pixel-transfer operations(scale,123bias, mapping, and clamping)are performed. The results are packed into an124appropriate format and then returned to processor memory.125126The pixel copy operation is similar to a combination of the unpacking and127transfer operations, except that packing and unpacking is unnecessary, and128only a single pass is made through the transfer operations before the data is129written back into the framebuffer.1301316. Fragment Operations132133If texturing is enabled, a texel is generated from texture memory for each134fragment and applied to the fragment. Then fog calculations are performed, if135theyre enabled, followed by coverage(antialiasing)calculations if136antialiasing is enabled.137138Next comes scissoring, followed by the alpha test(in RGBA mode only), the139stencil test, the depth-buffer test, and dithering. All of these operations140can be disabled. Next, if in index mode, a logical operation is applied if one141has been specified. If in RGBA mode, blending is performed.142143The fragment is then masked by a color mask or an index mask, depending on the144mode, and drawn into the appropriate buffer. If fragments are being written145into the stencil or depth buffer, masking occurs after the stencil and depth146tests, and the results are drawn into the framebuffer without performing the147blending, dithering, or logical operation.1481497. Odds a
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025湖南衡阳市水务投资集团有限公司招聘30人考前自测高频考点模拟试题及答案详解(历年真题)
- 2025河北沧州孟村饶安高级中学招聘1人考前自测高频考点模拟试题及参考答案详解一套
- 2025广东依顿电子科技股份有限公司招聘高级经理岗模拟试卷附答案详解(考试直接用)
- 2025辽渔集团有限公司人员考前自测高频考点模拟试题及答案详解(考点梳理)
- 2025年福建省漳州市医院招聘若干人模拟试卷含答案详解
- 2025安徽皖信人力资源管理有限公司招聘某政务热线话务员招聘10人模拟试卷及一套答案详解
- 2025甘肃定西市岷县人力资源和社会保障局招聘城镇公益性岗位人员11人模拟试卷及1套参考答案详解
- 2025江苏盐城工学院招聘专职辅导员13人模拟试卷及一套参考答案详解
- 2025年河北北方学院附属第二医院选聘工作人员6名模拟试卷附答案详解(考试直接用)
- 2025河南信阳市潢川县退役军人事务局招聘3名全日制公益性岗位模拟试卷及答案详解一套
- 2025年河南省文化旅游投资集团有限公司权属企业社会招聘52人笔试参考题库附答案解析
- 吉林省松原市四校2025~2026学年度下学期九年级第一次月考试卷 物理(含答案)
- 2025云南昆明元朔建设发展有限公司第一批收费员招聘20人考试参考试题及答案解析
- 2025年北京市海淀区中考二模语文试题
- 上海工资发放管理办法
- 社会科学研究方法 课件 第九章 实地研究
- 2025秋统编版(2024)小学道德与法治三年级上册(全册)课时练习及答案(附目录)
- 医院空气消毒技术规范
- 药物外渗的PDCA循环管理
- 2024年乡村振兴应知应会考试题及答案
- 破局向新 持续向上-2025年人力资源发展趋势报告-智联招聘北大国发院
评论
0/150
提交评论