There seems to be a lot of ambiguity about gl_FragColor
being deprecated. For example, it is missing in the GLSL 4.40 specification, but it is included in the GLSL 4.60 specification.
What is the safest, most compatible, most supported strategy? Using gl_FragColor
or defining a shader output like out vec4 color
?
Yes, gl_FragColor
is deprecated. You should use the following syntax:
layout(location = 0) out vec4 diffuseColor;
It is included in the GLSL 4.60 spec under the section 7.1.7. Compatibility Profile Built-In Language Variables
. That means, if you create a core context this variable will not be available.