you have the standard input and output variables. You also have some types that are unique to glsl. For example attribute variables that are specific to a vertex. There are "uniform" variables that cuts across all vertices. There are reserved variables, there are built-in variables etc. This page will throw some light on this type of variables.

glsl varying in out variables

Search for: glsl varying in out variables

glsl varying qualifier deprecated?

Search for: glsl varying qualifier deprecated?

glsl language reference

Search for: glsl language reference

glsl docs


The keyword attribute for vertex shader inputs.  (Use in instead.)
The keyword varying for inputs and outputs.  (Use in and out instead.)
The original texturing built-in functions.  (Use the new forms instead.)
The built-in variables gl_FragColor and gl_FragData.  (Use out instead.)

OpenGL has a pipeline. data is sent from the client program to the vertex shader first. This is done through global variables of type "in" in the vertex shader program.

At the end of the vertex program you will know where on the screen will each vertex will land on. The coloring between the vertices and also the space like a triangle surface (called a primitive) is done by the next in the pipeline the fragment shader. Unlike a vertex a fragment shader deals with lot of pixels.

A client only specifies the colors at a vertex. How does the fragment shader know what is the color value at each pixel? To help this the values from the vertex shader are interpolated and passed to the fragment shader. These variables are declared as "out" variables in the vertex shader and "in" variables in the fragment shader.

These variables that travel from vertex shader to fragment shaders are interpolated and result many values for the same "in" variable in the vertex shader. That is why these variables are called "varying" variables.

in previous glsl version there is a qualifier called "varying" to indicate these variables that undergo interpolation. However in 4.2 the preferred approach seem to be declare them as merely "in/out" and the "varying" nature is implied.

variables that undergo interpolation as they go from one pipeline to the next are called varying variables.

The language spec pdf for glsl 4.2