So I was messing around with a floating point texture in a GLSL shader and I noticed that the value returned from texture2d(sampler2d, vec2) seems to clamp beyond [0,1]. Is there anyway to get it to use the actual value stored in the texture even if its beyond those values?
I understand when actually rendering the fragment color it will clamp beyond [0,1] unless this can be changed to, but I was planning on doing some multitexturing stuff, and being able to get values beyond [0,1] would be really helpful.
Use appropriate value with the right internal texture format when you create your texture :
glTexImage2D(GL_TEXTURE_2D,0,internalFormat,…)
Some of them are unclamped, GL_RGB16F_ARB for example. See the developer site of NVidia … there is a great page with all OpenGL extension, included the ones for unclamped texture format.
Can you put the code where you load your fp texture?
GL_FLOAT is not an internal but a data type, the type of the data you give for example to glTexImage2D.
Like dgedge said, internal format should be RGBA16F_ARB or RGBA32F_ARB.
BTW, GL_HALF_FLOAT or GL_FLOAT is not important. GL_FLOAT works with GL_RGBA16F_ARB or GL_RGBA32F_ARB.
Yes you are right, opengl do the conversion, 32 bits -> 16bits but in practice, I don’t any interest to lost precision with GL_RGBA16F_ARB using float data.