Opengl固定渲染管线操作顺序.docx_第1页
Opengl固定渲染管线操作顺序.docx_第2页
Opengl固定渲染管线操作顺序.docx_第3页
Opengl固定渲染管线操作顺序.docx_第4页
Opengl固定渲染管线操作顺序.docx_第5页
已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论