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.

satya - Sat Jul 28 2012 16:21:24 GMT-0400 (Eastern Daylight Time)

glsl varying in out variables

glsl varying in out variables

Search for: glsl varying in out variables

satya - Sat Jul 28 2012 16:26:02 GMT-0400 (Eastern Daylight Time)

glsl varying qualifier deprecated?

glsl varying qualifier deprecated?

Search for: glsl varying qualifier deprecated?

satya - Sat Jul 28 2012 16:30:53 GMT-0400 (Eastern Daylight Time)

glsl language reference

glsl language reference

Search for: glsl language reference

satya - Sat Jul 28 2012 16:31:08 GMT-0400 (Eastern Daylight Time)

glsl docs

glsl docs

satya - Sat Jul 28 2012 16:34:17 GMT-0400 (Eastern Daylight Time)

Latest version 4 changes


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.)

satya - Sat Jul 28 2012 16:41:58 GMT-0400 (Eastern Daylight Time)

So what is a varying variable anyway?

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.

satya - Sat Jul 28 2012 16:42:42 GMT-0400 (Eastern Daylight Time)

So what are they again in brief??

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

satya - Sat Jul 28 2012 16:43:31 GMT-0400 (Eastern Daylight Time)

The language spec pdf for glsl 4.2

The language spec pdf for glsl 4.2