From OpenGL Wiki
Revision as of 21:46, 20 October 2012 by Alfonse (talk | contribs) (De-stubifying.)
Jump to navigation Jump to search

A Shader is a program designed to run on some stage of a graphics processor. Its purpose is to execute one of the programmable stages of the rendering pipeline.


The rendering pipeline defines certain sections to be programmable. Each of these sections, or stages, represents a particular type of programmable processing. Each stage has a set of inputs and outputs, which are passed from prior stages and on to subsequent stages (whether programmable or not).

Shaders are written in the OpenGL Shading Language. The OpenGL rendering pipeline defines the following shader stages:

A program object can combine multiple shader stages (built from shader objects) into a single, linked whole. A program pipeline object can combine programs that contain individual shader stages into a whole pipeline.

While shader stages do use the same language, each stage has a separate set of inputs and outputs, as well as built-in variables. As such, shader objects are built for a specific shader stage. So while program objects can contain multiple stages, shader objects only contain code for a single stage.