0

When I call

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, w, h, 0, GL_RGBA, GL_FLOAT, data);

, it seems that OpenGL will clamp the values of data to [0.0, 1.0].

Is there some way to prevent OpenGL from clamping it, and just write the exact floating point data?

Side Note: I am curious, is there a valid reason for OpenGL to do this clamping? Or is it just (IMHO) poor design?

  • 4
    "*is there a valid reason for OpenGL to do this clamping? Or is it just (IMHO) poor design?*" It's neither. There is no clamping. You're doing something wrong. Either the contents of `data` are not what you think they are, or you are misinterpreting the values you get from the image. Without a proper [mcve], there's not much that can be done. – Nicol Bolas Jul 20 '20 at 02:37
  • I fight with this same problem before... see [Reflection and refraction impossible without recursive ray tracing?](https://stackoverflow.com/a/45140313/2521214) the only format that does not clamp I found at that time (on my gfx) was: `GL_LUMINANCE32F_ARB` most formats are designed for colors hence I guess GL implementation produced internal clamping... I used this `glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE32F_ARB, tsize, tsize, 0, GL_LUMINANCE, GL_FLOAT, data);` successfully without clamping – Spektre Jul 21 '20 at 08:11

0 Answers0