The following diagram illustrates how OpenGL processes data. As shown, commands enter from the left and proceed through a processing pipeline. Some commands specify geometric objects to be drawn, and others control how the objects are handled during various processing stages.
下图说明OpenGL如何处理数据。如图所示,命令从左侧输入并通过处理管道继续执行。一些命令指定要绘制的几何对象,另一些命令控制在不同的处理阶段如何处理对象。
The processing stages in basic OpenGL operation are as follows:
OpenGL基本操作的处理阶段如下:
1. Display listRather than having all commands proceed immediately through the pipeline, you can choose to accumulate some of them in a display list for processing later.
显示列表,而不是让所有命令都通过管道立即执行,您可以选择将其中一些命令累积到显示列表中,以便稍后处理。
2. EvaluatorThe evaluator stage of processing provides an efficient way to approximate curve and surface geometry by evaluating polynomial commands of input values.
求值器处理求值器阶段通过求输入值的多项式命令,提供了一种近似曲线和曲面几何的有效方法。
3. Per-vertex operations and primitive assemblyOpenGL processes geometric primitivespoints, line segments, and polygonsall of which are described by vertices. Vertices are transformed and lit, and primitives are clipped to the viewport in preparation for rasterization.
OpenGL处理几何原语点、线段和多边形,所有这些都是由顶点描述的。顶点被转换和点亮,原语被裁剪到视图端口,为栅格化做准备。
4. RasterizationThe rasterization stage produces a series of frame-buffer addresses and associated values using a two-dimensional description of a point, line segment, or polygon. Each fragment so produced is fed into the last stage, per-fragment operations.
光栅化阶段使用点、线段或多边形的二维描述生成一系列帧缓冲区地址和相关值。这样生成的每个片段都被送入最后一个阶段,即每个片段操作。
5. Per-fragment operationsThese are the final operations performed on the data before it is stored as pixels in the framebuffer.
每个片段操作这些是在数据作为像素存储在framebuffer之前对数据执行的最后操作。
Per-fragment operations include conditional updates to the framebuffer based on incoming and previously stored z values (for z buffering) and blending of incoming pixel colors with stored colors, as well as masking and other logical operations on pixel values.
每个片段操作包括根据传入的和先前存储的z值(用于z缓冲)对framebuffer进行条件更新,并将传入的像素颜色与存储的颜色混合,以及对像素值进行屏蔽和其他逻辑操作。
Data can be input in the form of pixels rather than vertices. Data in the form of pixels, such as might describe an image for use in texture mapping, skips the first stage of processing described above and instead is processed as pixels, in the pixel operations stage. Following pixel operations, the pixel data is either:
数据可以以像素而不是顶点的形式输入。像素形式的数据(例如可能描述用于纹理映射的图像)跳过了上述处理的第一阶段,而是在像素操作阶段作为像素处理。以下像素操作,像素数据为:
1. Stored as texture memory, for use in the rasterization stage.
存储为纹理内存,用于栅格化阶段。
2. Rasterized, with the resulting fragments merged into the framebuffer just as if they were generated from geometric data.
栅格化,结果片段合并到framebuffer中,就像它们是从几何数据生成的一样。