Vertex Processing

From OpenGL Wiki
Jump to: navigation, search

Vertex Processing represents the set of stages of the OpenGL rendering pipeline where a sequence of vertices are processed via a series of Shaders. The subsequent shader stages takes its data from the previous one. Many of these shader stages are optional, and the last active stage in any rendering operation provides vertex data to Vertex Post-Processing and beyond.

Vertex Shader

The vertex shader is the programmable stage in the rendering pipeline that handles the processing of individual vertices. A vertex shader receives a single vertex composed of a series of Vertex Attributes. This input vertex is processed arbitrarily to produce an output vertex. There must be a 1:1 mapping from input vertices to output vertices.

A vertex shader must be provided to have a valid rendering operation.

Tessellation

This stage takes the vertices output from the previous stage, collects them into primitives, and tessellates those primitives based on a pair of shader stages and a fixed-function tessellation system.

The tessellation stage is optional; if no tessellation evaluation shader exists, then the outputs from the vertex shader are passed to the next active stage.

Geometry Shader

A geometry shader (GS) is a Shader program that governs the processing of primitives. A GS receives a single base primitive and it can output a sequence of vertices that generates 0 or more primitives. This is unlike vertex shaders, which are limited to a 1:1 input to output ratio. A GS can also perform layered rendering, where different primitives can be rendered to different attached layered images.

The GS is optional; if it is not present, vertices passed from prior stages are given to the next stage directly.