Reputation: 53
I'm learning to write fragment shaders, but as I'm playing with blending modes, I'm confused about incoming values of gl_FragColor.
When main() is called in the frag shader, before it's modified within main(), what is the value of gl_FragColor? Is it always vec4(0.0, 0.0, 0.0, 1.0)? Is it the value of of previous passes at that same pixel? Is it something else? How is the value determined?
Upvotes: 0
Views: 353
Reputation: 45342
gl_FragColor
is an output value, not an input one. The GLSL 1.0 ES spec states:
Reading from these variables before writing to them results in an undefined value
So you can't rely on it being set to antything particular at all.
Upvotes: 4