PDA

View Full Version : problem with out variable



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?

Peter_dup1
07-30-2005, 08:52 AM
The code works fine for me (nVIDIA 5900 with 1.0-7664 driver). What card/driver are you using.

Peter

powerpad
07-30-2005, 11:20 AM
geforce 6600gt with the latest drivers

hmm I have to check again