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.
a vec4 is a vector of 4 floating point values; in this case a color defined as RGBA (red, green, blue, alpha).
As our collegue just said, gl_Position is not deprecated.
vec4 is a floating point vector with four components. It can be initialized by: Providing a scalar value for each component. Providing one scalar value. This value is used for all components.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With