Difference between revisions of "Fragment Shader"

From OpenGL.org
Jump to: navigation, search
(Outline of fragment shader page.)
(Overview)
Line 2: Line 2:
  
 
== Overview ==
 
== Overview ==
 +
 +
The fragment shader is the OpenGL pipeline stage after a primitive is [[Rasterization|rasterized]]. For each sample of the pixels covered by a primitive, a "fragment" is generated. Each fragment has a [[Window Space]] position, a few other values, and it contains all of the interpolated per-vertex output values from the last [[Vertex Processing]] stage.
 +
 +
The output of a fragment shader is a depth value, a possible stencil value (unmodified by the fragment shader), and zero or more color values to be potentially written to the buffers in the current framebuffers.
  
 
== Inputs ==
 
== Inputs ==

Revision as of 18:06, 3 October 2012

A Fragment Shader is a user-supplied program that, when executed, will process a Fragment from the rasterization process into a set of colors and a single depth value.

Overview

The fragment shader is the OpenGL pipeline stage after a primitive is rasterized. For each sample of the pixels covered by a primitive, a "fragment" is generated. Each fragment has a Window Space position, a few other values, and it contains all of the interpolated per-vertex output values from the last Vertex Processing stage.

The output of a fragment shader is a depth value, a possible stencil value (unmodified by the fragment shader), and zero or more color values to be potentially written to the buffers in the current framebuffers.

Inputs

Outputs

Output buffers

See also