Why am I not allowed to use varying variables?
Because they have been replaced by the more generic in
/out
variable concept since GLSL 1.30.
That became necessary because with GL3, the geometry shader was introduced, so a more generic communication method between shader stages was needed. Nowadays you just declare out
variables in one shader stage and have the same declarations as in
in the next shader stage you are using. The concept of varying is still the same - the outputs of the last shader stage (you use) before the rasterizer should match the inputs of the fragment shader (or the first shader stage after the rasterizer, but currently, there is no other), and the data will be interpolated across the primitive per default (if you don't declare it as flat
, or use types which can't be interpolated).