How do I get the current color of a fragment?
Posted
by Mason Wheeler
on Stack Overflow
See other posts from Stack Overflow
or by Mason Wheeler
Published on 2010-04-29T21:25:03Z
Indexed on
2010/04/29
21:27 UTC
Read the original article
Hit count: 313
I'm trying to wrap my head around shaders in GLSL, and I've found some useful resources and tutorials, but I keep running into a wall for something that ought to be fundamental and trivial: how does my fragment shader retrieve the color of the current fragment?
You set the final color by saying gl_FragColor = whatever
, but apparently that's an output-only value. How do you get the original color of the input so you can perform calculations on it? That's got to be in a variable somewhere, but if anyone out there knows its name, they don't seem to have recorded it in any tutorial or documentation that I've run across so far, and it's driving me up the wall.
© Stack Overflow or respective owner