I need gl_FragColor to "paint" floating point values, which also can be negative (x < 0) and > 1.0. I then want to use the color attachement of the FBO this values where rendered to and use it as a texture in another FBO. Now I have read on http://www.khronos.org/opengles/sdk/docs/man/ (under glTexImage2D) that all values are clamped to a range of [0, 1] and also I didn't find a glClampColor instruction. Is there a possibility to find a workaround here or does somebody have an idea which could help me with my problem? :)
SOLVED
It is possible and the values are not clamped to [0, 1] at all, when using floating point textures, but it does only work using GL_HALF_FLOAT_OES as the texture's internal format. Using GL_FLOAT instead results into an incomplete framebuffer object, which is really sad, cause I was building a summed area table (SAT) and got a big precision problem here. So in general it seems like only half precision (2 bytes, 1 sign bit + 5 exponent bits + 10 fraction) floating point numbers are supported on the iPad2.
Working creation of the FBO's color attachement texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_HALF_FLOAT_OES, NULL);
One more thing to mention: Instruments will report an "Invalid enum for argument 'type'" message, but it does work anyway. Also, the simulator will use full precision textures instead the specified half precision (I think cause there is no such data type in C). This is why u propably will get less precision problems on the simulator.
But the most confusing thing is that "GL_OES_texture_float" is supported when printing glGetString(GL_EXTENSIONS). However as mentioned before it does not work.
The whole thing about float textures is to support aprox [+inf,-inf] in shaders. You may find more useful information here: render to floating point texture under iOS
I do not believe this is true for float textures. Check the extension docs:
http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt
It mentions:
"The selected groups are processed as described in section 3.6.2, stopping after final expansion to RGBA. If the internal format of the texture is fixed-point, components are clamped to [0,1]. Otherwise, values are not modified."