0
votes

Is it possible in GLSL to add to a floating point texture from within a fragment shader?

For example if i just want to know how often a fragment shader is called for one pixel, can i write a fragment shader that just adds 1 to the corresponding floating point texture pixel?

Because i only found how to set the output value, which is then just overwriting the old value or is somehow alphablended, which i think is a weighted multiplication and can not be used for adding.

1

1 Answers

0
votes

which i think is a weighted multiplication and can not be used for adding.

No. Blending can do more than a weighted multiplication. It's perfectly capable of doing additive blending; just set the source and destination factors to GL_ONE. That will reduce the equation to Src + Dst.