i am trying to write a simple arb_fragment_program that checks if there is a texture bound to to the fragment or not. if there is a texture, it takes the color from the texture and multiplies it with the fragment.color. if not, it takes only the fragment.color.
to do the checks, i use the standard return values of TEX and modify them to get a negative/positive number that is passed to KIL. the documentation on ARB_fragment_program sais that the return values of TEX are (R=0, G=0, B=0, A=1).
so i wrote this code:
OUTPUT out = result.color;
MOV out, fragment.color;
TEX temp, fragment.texcoord, texture, 2D;
ADD istex.x, temp.x, temp.y;
ADD istex.x, istex.x, temp.z;
ADD istex.x, istex.x, -0.001;
MUL out, fragment.color, temp;
this would work if TEX would return the values that it should return. but it returns (R=0.443, G=0.522, B=0.188, A=1).