Feeding floats outside of range to ofTexture?

So, I’ve got a program that’s going to be doing some funny stuff with GLSL shaders. Namely, using things that aren’t pixel colors as pixel colors. I’m using the ofTexture::loadData(*float, w, h, GL_RGBA) function to feed in the data from an array of floats, which seems to be working smoothly.

What I want to know is if loading floats into a texture this way is going to clamp the float values between 0 and 1, convert them to chars, or do any other such funny business that might mess up my program’s design. After the floats are loaded into the texture object, I plan on feeding that texture to a GLSL shader that will do some operations using the float values.

So, as an example, I might load a pixel into this texture with the values {0.0, 3.2, -1.2, 1.0} before passing that texture off to the GLSL fragment shader. When I get that texture in to the GLSL shader and sample it at that pixel’s location, will the values still be {0.0, 3.2, -1.2, 1.0}, or will they be something else?

I’ve fed values like this in to a texture and then drawn it onto the screen, and nothing caught fire. On the screen, pixels outside the range are just displayed as the outer limit of the range, which should be expected, but I don’t know if that clamping is happening when the GPU draws it to the screen, or earlier on when the program loads the data into the texture. Furthermore, I don’t know if the floats passed to the texture stay as floats, or if they’re made into chars, which would severely limit their precision.

I’m trying to figure this out before I get too far into coding the application, because if that behavior is off from what I’d expect then I might have to make some major alterations to the high-level flow of my program. Any help is much appreciated, thanks!

just allocate your texture using GL_RGBA32F or GL_RGBA16F and there won’t be any conversion or clamping. GL_RGBA16F will have half the resolution but it might be fine dependending on what you are doing and it’s usually faster

Ah, thanks, that’s exactly what I was looking for!