Advertisement

How to write to floating point texture in GLSL?

Started by October 27, 2021 09:23 AM
1 comment, last by cgrant 3 years, 3 months ago

As I understand, if I create a floating point texture ( type RGBA32F / FLOAT) I can read float values directly like so:

float val = float(texture2D(float_tex, texel_xy));

but how do I write to one, is there a built-in function or syntax for that, how to auto-encode value to pixel?

gl_FragColor = 3.1415; ???

thank you!

If the texture is bound to the write render target/color attachment, then the data will be written to the texture just as expected. Depending on the texture format, conversion may occur when writing to the texture. However, in this case, with a floating point texture, the should be no conversion.

This topic is closed to new replies.

Advertisement