.cpp
I stored TEX and texture for fbo with format R16F .
.frag
uniform sampler2D TEX;
uniform float uniformValue;
case 1 : load uniformValue -> 0.0f
{
float texColor_R = texture(TEX, texCoords).r;
float mixFactor = uniformValue;
float R = mix(0,texColor_R,mixFactor );
gl_FragColor = vec4( R,R,R,1.0 );
}
case 2 : fixed value(0.0f) in code
{
float texColor_R = texture(TEX, texCoords).r;
float mixFactor = 0.0f;//@change
float R = mix(0, texColor_R, mixFactor );
gl_FragColor = vec4( R,R,R,1.0 );
}
case 2 works fine but case 1 does not.
I did not know what the problem was, so I just changed textures(TEX and texture for fbo) to R32F and it worked fine at both case1 and case2.
Why does this happen?
please let me know how to avoid the texture formatting issue.