I wrote a very simple shader program which should subtract 2 textures:
uniform sampler2DRect vergleich;
uniform sampler2DRect fbo;
void main (void)
{
vec4 texcolor = textureRect( vergleich, gl_TexCoord[0].st );
vec4 texcolor2 = textureRect( fbo, gl_TexCoord[0].st );
vec4 color = texcolor - texcolor2;
gl_FragColor = color;
}
My problem is now that the result of this shader is equal to “texcolor”.
If I write in gl_FragColor = texcolor2; I become the fbo texture. If I write gl_FragColor = texcolor; I become the vergleich texture which I become too if I write gl_FragColor = texcolor - texcolor2;.
So the textures are read right in the shader I don’t know why the subtraction is ignored.
The fbo texture hast values from 0 to 255 and the vergleich from 0 to 4 so I wonder why I don’t get some large negative values when I read my result. (It is rendered in an FBO Texture with float32 format.)
dodgersnow