0

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.

lenn
  • 5
  • 3

1 Answers1

0

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.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • Wow, that is so simple it makes me think i violated the "search first, then ask" rule ;) Thank you very much! :) – lenn Jun 20 '12 at 13:38