Graphics Programs Reference
A vertex shader takes the geometry data, such as vertices in 3D space, of an object
and transforms this data to the 2D coordinates at which it appears on the display
screen. Then the rendering pipeline generates appropriate fragments for this object,
which are then processed by a fragment shader for coloring, lighting, and/or textur-
ing of the object (as shown in Figure 3-9 ).
Note Each fragment represents a pixel (x, y) on the display screen
that is yet to be processed by a fragment shader for coloration.
Finally, the fragment data is stored in a framebuffer to provide color values for those
pixels on the display screen that represent this object. Simply, a vertex shader defines
the final position of an object on the display screen (as a collection of vertices), as
shown in Figure 3-7 , whereas a fragment shader defines the final color of pixels that
are filled by this object ( Figure 3-9 ).
Vertex Shader Example
Now, we discuss a vertex shader (written using GLSL ) to define a point. As you
know, a renderer specified using the setRenderer (GLSur-
faceView.Rendererrenderer) method actually renders graphics on the