powerpad
07-30-2005, 02:03 AM
(this is not the actual code but a simpliefied example)
void func(out float x)
{
x = 0.8;
}
void main()
{
float t;
func(t);
gl_FragColor = vec4(t, t, t, 1.0);
}this produces black fragments like t is 0.0
but if I do the following
void func(out float x)
{
x = 0.8;
}
void main()
{
float t;
func(t);
if(t == 0.8)
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
else
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}I get correct result - green fragments.
I can not have the if statement since func is some function that calculates stuff and I can not test the result against some value. I tried with
float func()
{
return 0.8
}but I got the same result (nothing), did I do something wrong?
void func(out float x)
{
x = 0.8;
}
void main()
{
float t;
func(t);
gl_FragColor = vec4(t, t, t, 1.0);
}this produces black fragments like t is 0.0
but if I do the following
void func(out float x)
{
x = 0.8;
}
void main()
{
float t;
func(t);
if(t == 0.8)
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
else
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}I get correct result - green fragments.
I can not have the if statement since func is some function that calculates stuff and I can not test the result against some value. I tried with
float func()
{
return 0.8
}but I got the same result (nothing), did I do something wrong?