The first processing stage that Gideros deals with is the Vertex shader. As its name implies, its purpose is to manipulate vertices for the geometry being rendered. No real big deal here, most of the work of a vertex shader is transforming geometry coordinates from sprite local space to actual window coordinates. Other input data is most of the time just passed along unmodified to the next stage. Vertex shaders typically uses the following attributes:
- Vertex coordinates (always).
- Texture coordinates (if required).
- Vertex color (if required).
The fragment shader is the most interesting. It takes its inputs from the vertex shader’s outputs but is applied to every pixel of the shape being rendered. Input data from the vertex shader is interpolated and then fed to the fragment shader. The final goal of the fragment shader is to produce the color of the pixel to actually draw. Fragment shaders typically uses the following attributes:
- Interpolated texture coordinates (if required).
- Interpolated pixel color (if required).