🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to write to floating point texture in GLSL?

Started by
1 comment, last by cgrant 2 years, 8 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!

Advertisement

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