Hi, I’m using a FBO for offscreen rendering in order to process the data within a fragment program in a first pass and then do normal rendering to the framebuffer in a second pass. I pass the data to the fragment program by rendering a textured quad to a texture in the FBO (RTT actually).
Everything works fine as long as I use a floating point texture (RGB32F_ARB) as input for both my input texture and the target (FBO) texture.
The output of my computation are always 3 floats and therefore the FBO texture remains the same (RGB32F_ARB). However the input data should now come from two different textures with different formats: One should contain 4 unsigned chars, so I chose RGBA8, and the other should contain 1 unsigned char, therefore I selected ALPHA8.
Now the problems:
- The content of the first texture (RGBA8 on texture unit GL_TEXTURE0) is being clamped to be within [0,1], and I can’t understand why.
- The content of the second texture (ALPHA8 on texture unit GL_TEXTURE1) is empty (all 0) when I read it back with glReadPixels.
And finally my questions
Can anyone explain the clamping behaviour? I’m getting around it by scaling the values back in the fragment program, which seems to work, but I’d like to understand why this is happening at all.
And more important, has anyone experienced problems with multitexturing while rendering to a FBO? It seems to me that the second texture unit (GL_TEXTURE1) is being ignored, even though I pass the right values (0 and 1 respectively) to the fragment program as uniforms (GLSL) for accessing the correct texture with texture2D.
Any help, comment or extra info would be much appreciated.