4.6. Summary
Two new programmable units have been added to OpenGL: the vertex processor and the fragment processor. The same language, with minor differences, expresses algorithms intended to run on either processor. The vertex processor replaces the fixed functionality vertex processing of OpenGL, and a shader intended for execution on this processor is called a vertex shader. When installed as part of current state, the vertex shader is executed once for each vertex that is processed by OpenGL. The fragment processor replaces the fixed functionality fragment processing of OpenGL, and a shader that is intended for execution on this processor is called a fragment shader. When installed as part of current state, the fragment shader is executed once for each fragment that arises from rasterization.
Great care was taken to define the interfaces between the programmable stages of OpenGL and the intervening fixed functionality. As a result, rendering is permitted with programmable vertex processing and fixed functionality fragment processing, or vice versa. Built-in variables allow access to standard OpenGL attributes, implementation-dependent constants, and a variety of current state. They also allow a shader to communicate with the preceding and following fixed functionality stages of the graphicsprocessing pipeline.
|